Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<CentralPackageVersionsFile>$(MSBuildThisFileDirectory)Directory.Packages.props</CentralPackageVersionsFile>
</PropertyGroup>

<ItemGroup>
<PackageVersion Include="Aspire.Hosting" Version="9.0.0" />
<PackageVersion Include="Aspire.Hosting.AppHost" Version="9.0.0" />
<PackageVersion Include="Aspire.Hosting.MongoDB" Version="9.0.0" />

<!-- OpenTelemetry -->
<PackageVersion Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.10.0" />
<PackageVersion Include="OpenTelemetry.Extensions.Hosting" Version="1.10.0" />

<!-- Microsoft -->
<PackageVersion Include="Microsoft.AspNetCore.OpenApi" Version="10.0.0" />
<PackageVersion Include="Microsoft.AspNetCore.Components.Web" Version="10.0.0" />
<PackageVersion Include="Microsoft.Extensions.ServiceDiscovery" Version="10.0.0" />

<!-- MongoDB -->
<PackageVersion Include="MongoDB.Entities" Version="25.0.0" />
<PackageVersion Include="MongoDB.Driver" Version="3.2.0" />

<!-- API Documentation -->
<PackageVersion Include="Scalar.AspNetCore" Version="1.2.51" />

<!-- Testing (for later use) -->
<PackageVersion Include="xunit" Version="2.8.1" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.8.1" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.13.0" />
<PackageVersion Include="FluentAssertions" Version="6.12.1" />
<PackageVersion Include="NSubstitute" Version="5.2.0" />
</ItemGroup>
</Project>
12 changes: 12 additions & 0 deletions IssueManager.slnx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"$schema": "http://json.schemastore.org/solution-manifest-1.0.json",
"version": "0.1",
"name": "IssueManager",
"description": "Issue management application with modern architecture patterns and async/reactive workflows",
"projects": [
"src/AppHost/AppHost.csproj",
"src/ServiceDefaults/ServiceDefaults.csproj",
"src/Api/Api.csproj",
"src/Web/Web.csproj"
]
}
5 changes: 5 additions & 0 deletions global.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"sdk": {
"version": "10.0.200-preview.0.26103.119"
}
}
25 changes: 25 additions & 0 deletions src/Api/Api.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<LangVersion>14.0</LangVersion>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>IssueManager.Api</RootNamespace>
<InvariantGlobalization>false</InvariantGlobalization>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Aspire.Hosting.AppHost" />
Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Api project should not reference the Aspire.Hosting.AppHost package. This package is intended for orchestrator projects (like AppHost) that manage service topology. API services should not include this dependency. Remove this PackageReference from the Api project.

Suggested change
<PackageReference Include="Aspire.Hosting.AppHost" />

Copilot uses AI. Check for mistakes.
<PackageReference Include="Microsoft.AspNetCore.OpenApi" />
<PackageReference Include="Scalar.AspNetCore" />
<PackageReference Include="MongoDB.Entities" />
</ItemGroup>

<ItemGroup>
<ProjectCapability Include="CanEvaluateItemsWithTargetFramework" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\ServiceDefaults\ServiceDefaults.csproj" />
</ItemGroup>
</Project>
36 changes: 36 additions & 0 deletions src/Api/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using IssueManager.ServiceDefaults;

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddServiceDefaults();

builder.Services.AddOpenApi();

var app = builder.Build();

app.UseHttpsRedirection();
Comment on lines +7 to +11
Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to the coding guidelines, antiforgery tokens are required for security. The Api project should call builder.Services.AddAntiforgery() and app.UseAntiforgery() to protect against CSRF attacks, especially if the API will be consumed by the Blazor Web frontend.

Suggested change
builder.Services.AddOpenApi();
var app = builder.Build();
app.UseHttpsRedirection();
builder.Services.AddOpenApi();
builder.Services.AddAntiforgery();
var app = builder.Build();
app.UseHttpsRedirection();
app.UseAntiforgery();

Copilot uses AI. Check for mistakes.
app.MapOpenApi();

var summaries = new[] { "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" };

app.MapGet("/weatherforecast", () =>
{
var forecast = Enumerable.Range(1, 5).Select(index =>
new WeatherForecast(
DateOnly.FromDateTime(DateTime.Now.AddDays(index)),
Random.Shared.Next(-20, 55),
summaries[Random.Shared.Next(summaries.Length)]
))
.ToArray();
return forecast;
})
.WithName("GetWeatherForecast");

app.MapHealthChecks("/health");

app.Run();

internal record WeatherForecast(DateOnly Date, int TemperatureC, string? Summary)
{
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
}
24 changes: 24 additions & 0 deletions src/AppHost/AppHost.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>
<LangVersion>14.0</LangVersion>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>IssueManager.AppHost</RootNamespace>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Aspire.Hosting" />
<PackageReference Include="Aspire.Hosting.AppHost" />
<PackageReference Include="Aspire.Hosting.MongoDB" />
</ItemGroup>

<ItemGroup>
<ProjectCapability Include="CanEvaluateItemsWithTargetFramework" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\ServiceDefaults\ServiceDefaults.csproj" />
</ItemGroup>
</Project>
15 changes: 15 additions & 0 deletions src/AppHost/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
var builder = DistributedApplication.CreateBuilder(args);

var mongodb = builder
.AddMongoDB("mongodb")
.AddDatabase("issuemanager");

var api = builder
.AddProject("api", "../Api/Api.csproj")
.WithReference(mongodb);

builder
.AddProject("web", "../Web/Web.csproj")
.WithReference(api);

builder.Build().Run();
27 changes: 27 additions & 0 deletions src/ServiceDefaults/Extensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
namespace IssueManager.ServiceDefaults;

using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Diagnostics.HealthChecks;

/// <summary>
/// Extension methods for service defaults configuration.
/// </summary>
public static class Extensions
{
/// <summary>
/// Adds default service configuration for Aspire services.
/// </summary>
public static IServiceCollection AddServiceDefaults(this IServiceCollection services)
{
services.AddServiceDiscovery();
return services;
}

/// <summary>
/// Adds default health check configuration.
/// </summary>
public static IHealthChecksBuilder AddDefaultHealthChecks(this IServiceCollection services)
{
return services.AddHealthChecks();
}
}
20 changes: 20 additions & 0 deletions src/ServiceDefaults/ServiceDefaults.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<LangVersion>14.0</LangVersion>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>IssueManager.ServiceDefaults</RootNamespace>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Aspire.Hosting" />
Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ServiceDefaults project should not reference the Aspire.Hosting package. ServiceDefaults is a shared library for configuring individual services, not an orchestrator. This package is only needed in the AppHost project. Remove this PackageReference from the ServiceDefaults project.

Suggested change
<PackageReference Include="Aspire.Hosting" />

Copilot uses AI. Check for mistakes.
<PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" />
<PackageReference Include="OpenTelemetry.Extensions.Hosting" />
<PackageReference Include="Microsoft.Extensions.ServiceDiscovery" />
</ItemGroup>

<ItemGroup>
<ProjectCapability Include="CanEvaluateItemsWithTargetFramework" />
</ItemGroup>
</Project>
21 changes: 21 additions & 0 deletions src/Web/App.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
@namespace IssueManager.Web
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<base href="/" />
<link rel="stylesheet" href="bootstrap/bootstrap.min.css" />
<link rel="stylesheet" href="app.css" />
<link rel="stylesheet" href="IssueManager.Web.styles.css" />
<link rel="icon" type="image/png" href="favicon.png" />
</head>

<body>
<Routes />
<script src="_framework/blazor.web.js"></script>
</body>

</html>

26 changes: 26 additions & 0 deletions src/Web/Layout/MainLayout.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
@namespace IssueManager.Web.Layout
@inherits LayoutComponentBase
@implements IAsyncDisposable

<div class="page">
<div class="sidebar">
<NavMenu />
</div>

<main>
<div class="top-row px-4">
<a href="https://learn.microsoft.com/aspnet/core/" target="_blank">About</a>
</div>

<article class="content px-4">
@Body
</article>
</main>
</div>

@code {
async ValueTask IAsyncDisposable.DisposeAsync()
{
await Task.CompletedTask;
}
}
21 changes: 21 additions & 0 deletions src/Web/Layout/NavMenu.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
@namespace IssueManager.Web.Layout

<div class="navbar navbar-dark bg-dark">
<div class="container-fluid">
<a class="navbar-brand" href="">IssueManager</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav ms-auto">
<li class="nav-item">
<a class="nav-link" href="">Home</a>
</li>
</ul>
</div>
</div>
</div>

@code {

}
12 changes: 12 additions & 0 deletions src/Web/Pages/Home.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
@namespace IssueManager.Web.Pages
@page "/"

<PageTitle>Home</PageTitle>

<h1>Welcome to IssueManager</h1>

<p>This application demonstrates modern .NET architecture patterns with Aspire, Blazor, and MongoDB.</p>

@code {

}
28 changes: 28 additions & 0 deletions src/Web/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using IssueManager.ServiceDefaults;
using IssueManager.Web;

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddServiceDefaults();

builder.Services.AddRazorComponents()
.AddInteractiveServerComponents();

var app = builder.Build();

if (!app.Environment.IsDevelopment())
{
app.UseExceptionHandler("/Error", createScopeForErrors: true);
app.UseHsts();
}

app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseAntiforgery();

app.MapRazorComponents<App>()
.AddInteractiveServerRenderMode();

app.MapHealthChecks("/health");

app.Run();
14 changes: 14 additions & 0 deletions src/Web/Routes.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
@namespace IssueManager.Web

<Router AppAssembly="typeof(App).Assembly">
<Found Context="routeData">
<RouteView RouteData="@routeData" DefaultLayout="typeof(IssueManager.Web.Layout.MainLayout)" />
</Found>
<NotFound>
<PageTitle>Not found</PageTitle>
<LayoutView Layout="typeof(IssueManager.Web.Layout.MainLayout)">
<p role="alert">Sorry, there's nothing at this address.</p>
</LayoutView>
</NotFound>
</Router>

22 changes: 22 additions & 0 deletions src/Web/Web.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<LangVersion>14.0</LangVersion>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>IssueManager.Web</RootNamespace>
<InvariantGlobalization>false</InvariantGlobalization>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Aspire.Hosting.AppHost" />
</ItemGroup>

<ItemGroup>
<ProjectCapability Include="CanEvaluateItemsWithTargetFramework" />
</ItemGroup>

Comment on lines +12 to +18
Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Web project should not reference the Aspire.Hosting.AppHost package. This package is intended for orchestrator projects (like AppHost) that manage service topology. Blazor web applications should not include this dependency. Remove this PackageReference from the Web project.

Suggested change
<PackageReference Include="Aspire.Hosting.AppHost" />
</ItemGroup>
<ItemGroup>
<ProjectCapability Include="CanEvaluateItemsWithTargetFramework" />
</ItemGroup>
<ProjectCapability Include="CanEvaluateItemsWithTargetFramework" />
</ItemGroup>

Copilot uses AI. Check for mistakes.
<ItemGroup>
<ProjectReference Include="..\ServiceDefaults\ServiceDefaults.csproj" />
</ItemGroup>
</Project>
7 changes: 7 additions & 0 deletions src/Web/_Imports.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
@using System.Globalization
@using Microsoft.AspNetCore.Components
@using Microsoft.AspNetCore.Components.Routing
@using Microsoft.AspNetCore.Components.Web
@using IssueManager.Web
@using IssueManager.Web.Layout
@using IssueManager.Web.Pages
Loading
Loading