Skip to content

Commit 48b6365

Browse files
authored
Moved and cleaned up project structure (removed AStar.Web.Web, migrated contents to AStar.Web). (#2)
1 parent 2d13183 commit 48b6365

File tree

32 files changed

+228
-175
lines changed

32 files changed

+228
-175
lines changed

.github/copilot-instructions.md

Lines changed: 94 additions & 50 deletions
Large diffs are not rendered by default.

.github/instructions/blazor.instructions.md

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ applyTo: '**/*.razor, **/*.razor.cs, **/*.razor.css'
2929
## Error Handling and Validation
3030

3131
- Implement proper error handling for Blazor pages and API calls.
32-
- Use logging for error tracking in the backend and consider capturing UI-level errors in Blazor with tools like ErrorBoundary.
32+
- Use logging for error tracking in the backend and consider capturing UI-level errors in Blazor with tools like
33+
ErrorBoundary.
3334
- Implement validation using FluentValidation or DataAnnotations in forms.
3435

3536
## Blazor API and Performance Optimization
@@ -42,17 +43,23 @@ applyTo: '**/*.razor, **/*.razor.cs, **/*.razor.css'
4243

4344
## Caching Strategies
4445

45-
- Implement in-memory caching for frequently used data, especially for Blazor Server apps. Use IMemoryCache for lightweight caching solutions.
46+
- Implement in-memory caching for frequently used data, especially for Blazor Server apps. Use IMemoryCache for
47+
lightweight caching solutions.
4648
- For Blazor WebAssembly, utilize localStorage or sessionStorage to cache application state between user sessions.
47-
- Consider Distributed Cache strategies (like Redis or SQL Server Cache) for larger applications that need shared state across multiple users or clients.
48-
- Cache API calls by storing responses to avoid redundant calls when data is unlikely to change, thus improving the user experience.
49+
- Consider Distributed Cache strategies (like Redis or SQL Server Cache) for larger applications that need shared state
50+
across multiple users or clients.
51+
- Cache API calls by storing responses to avoid redundant calls when data is unlikely to change, thus improving the user
52+
experience.
4953

5054
## State Management Libraries
5155

5256
- Use Blazor's built-in Cascading Parameters and EventCallbacks for basic state sharing across components.
53-
- Implement advanced state management solutions using libraries like Fluxor or BlazorState when the application grows in complexity.
54-
- For client-side state persistence in Blazor WebAssembly, consider using Blazored.LocalStorage or Blazored.SessionStorage to maintain state between page reloads.
55-
- For server-side Blazor, use Scoped Services and the StateContainer pattern to manage state within user sessions while minimizing re-renders.
57+
- Implement advanced state management solutions using libraries like Fluxor or BlazorState when the application grows in
58+
complexity.
59+
- For client-side state persistence in Blazor WebAssembly, consider using Blazored.LocalStorage or
60+
Blazored.SessionStorage to maintain state between page reloads.
61+
- For server-side Blazor, use Scoped Services and the StateContainer pattern to manage state within user sessions while
62+
minimizing re-renders.
5663

5764
## API Design and Integration
5865

@@ -64,13 +71,16 @@ applyTo: '**/*.razor, **/*.razor.cs, **/*.razor.css'
6471
- All unit testing and integration testing should be done in Visual Studio Enterprise.
6572
- Test Blazor components and services using xUnit.V3 and bUnit for component testing.
6673
- Use NSubstitute for mocking dependencies during tests.
67-
- Use Shouldly for fluent assertions in tests. Fallback to xUnit built-in assertions when Shouldly does not provide the needed functionality.
68-
- Debug Blazor UI issues using browser developer tools and Visual Studio's debugging tools for backend and server-side issues.
74+
- Use Shouldly for fluent assertions in tests. Fallback to xUnit built-in assertions when Shouldly does not provide the
75+
needed functionality.
76+
- Debug Blazor UI issues using browser developer tools and Visual Studio's debugging tools for backend and server-side
77+
issues.
6978
- For performance profiling and optimization, rely on Visual Studio's diagnostics tools.
7079

7180
## Security and Authentication
7281

73-
- Implement Authentication and Authorization in the Blazor app where necessary using ASP.NET Identity or JWT tokens for API authentication.
82+
- Implement Authentication and Authorization in the Blazor app where necessary using ASP.NET Identity or JWT tokens for
83+
API authentication.
7484
- Use HTTPS for all web communication and ensure proper CORS policies are implemented.
7585

7686
## API Documentation and Scalar

.github/prompts/astar.prompt.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ description: 'Create ASP.NET Minimal API endpoints with proper OpenAPI documenta
66

77
# ASP.NET Minimal API with OpenAPI
88

9-
Your goal is to help me create well-structured ASP.NET Minimal API endpoints with correct types and comprehensive OpenAPI/Swagger documentation.
9+
Your goal is to help me create well-structured ASP.NET Minimal API endpoints with correct types and comprehensive
10+
OpenAPI/Swagger documentation.
1011

1112
## API Organization
1213

.github/prompts/xunit.prompt.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ description: 'Get best practices for XUnit unit testing, including data-driven t
66

77
# XUnit Best Practices
88

9-
Your goal is to help me write effective unit tests with XUnit.V3, covering both standard and data-driven testing approaches.
9+
Your goal is to help me write effective unit tests with XUnit.V3, covering both standard and data-driven testing
10+
approaches.
1011

1112
## Project Setup
1213

@@ -48,7 +49,8 @@ Your goal is to help me write effective unit tests with XUnit.V3, covering both
4849

4950
## Assertions
5051

51-
- Use the `Shouldly` NuGet package for more readable assertions. Only use the xUnit built-in assertions when Shouldly does not provide the needed functionality.
52+
- Use the `Shouldly` NuGet package for more readable assertions. Only use the xUnit built-in assertions when Shouldly
53+
does not provide the needed functionality.
5254
- Use `Assert.Equal` for value equality
5355
- Use `Assert.Same` for reference equality
5456
- Use `Assert.True`/`Assert.False` for boolean conditions

.github/workflows/main_astar-dev.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
uses: actions/setup-dotnet@v5
2626
with:
2727
dotnet-version: '10.0.x'
28-
28+
2929
- name: 🛠 Set up JDK 17
3030
uses: actions/setup-java@v4
3131
with:

AStar.Web.slnx

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,34 @@
11
<Solution>
2-
<Folder Name="/Solution Items/" />
3-
<Folder Name="/Solution Items/.github/">
4-
<File Path=".github\codeql.yml" />
5-
<File Path=".github\copilot-instructions.md" />
6-
<File Path=".github\dependabot.yml" />
7-
</Folder>
8-
<Folder Name="/Solution Items/.github/instructions/">
9-
<File Path=".github\instructions\blazor.instructions.md" />
10-
</Folder>
11-
<Folder Name="/Solution Items/.github/prompts/">
12-
<File Path=".github\prompts\astar.prompt.md" />
13-
<File Path=".github\prompts\xunit.prompt.md" />
14-
</Folder>
15-
<Folder Name="/Solution Items/.github/workflows/">
16-
<File Path=".github\workflows\main_astar-dev.yml" />
17-
</Folder>
18-
<Folder Name="/src/" />
19-
<Folder Name="/src/aspire/">
20-
<Project Path="src/aspire/AStar.Web.AppHost/AStar.Web.AppHost.csproj" />
21-
<Project Path="src/aspire/AStar.Web.ServiceDefaults/AStar.Web.ServiceDefaults.csproj" />
22-
</Folder>
23-
<Folder Name="/src/modules/" />
24-
<Folder Name="/src/modules/apis/">
25-
<Project Path="src/modules/apis/AStar.Web.ApiService/AStar.Web.ApiService.csproj" />
26-
</Folder>
27-
<Folder Name="/src/uis/">
28-
<Project Path="src/uis/AStar.Web.Web/AStar.Web.Web.csproj" />
29-
</Folder>
30-
<Folder Name="/test/" />
31-
<Folder Name="/test/aspire/">
32-
<Project Path="test/aspire/AStar.Web.Tests/AStar.Web.Tests.csproj" />
33-
</Folder>
2+
<Folder Name="/Solution Items/"/>
3+
<Folder Name="/Solution Items/.github/">
4+
<File Path=".github\codeql.yml"/>
5+
<File Path=".github\copilot-instructions.md"/>
6+
<File Path=".github\dependabot.yml"/>
7+
</Folder>
8+
<Folder Name="/Solution Items/.github/instructions/">
9+
<File Path=".github\instructions\blazor.instructions.md"/>
10+
</Folder>
11+
<Folder Name="/Solution Items/.github/prompts/">
12+
<File Path=".github\prompts\astar.prompt.md"/>
13+
<File Path=".github\prompts\xunit.prompt.md"/>
14+
</Folder>
15+
<Folder Name="/Solution Items/.github/workflows/">
16+
<File Path=".github\workflows\main_astar-dev.yml"/>
17+
</Folder>
18+
<Folder Name="/src/"/>
19+
<Folder Name="/src/aspire/">
20+
<Project Path="src/aspire/AStar.Web.AppHost/AStar.Web.AppHost.csproj"/>
21+
<Project Path="src/aspire/AStar.Web.ServiceDefaults/AStar.Web.ServiceDefaults.csproj"/>
22+
</Folder>
23+
<Folder Name="/src/modules/"/>
24+
<Folder Name="/src/modules/apis/">
25+
<Project Path="src/modules/apis/AStar.Web.ApiService/AStar.Web.ApiService.csproj"/>
26+
</Folder>
27+
<Folder Name="/src/uis/">
28+
<Project Path="src\uis\AStar.Web\AStar.Web.csproj"/>
29+
</Folder>
30+
<Folder Name="/test/"/>
31+
<Folder Name="/test/aspire/">
32+
<Project Path="test/aspire/AStar.Web.Tests/AStar.Web.Tests.csproj"/>
33+
</Folder>
3434
</Solution>

src/aspire/AStar.Web.AppHost/AStar.Web.AppHost.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
</PropertyGroup>
1010

1111
<ItemGroup>
12-
<ProjectReference Include="..\..\modules\apis\AStar.Web.ApiService\AStar.Web.ApiService.csproj" />
13-
<ProjectReference Include="..\..\uis\AStar.Web.Web\AStar.Web.Web.csproj" />
12+
<ProjectReference Include="..\..\modules\apis\AStar.Web.ApiService\AStar.Web.ApiService.csproj"/>
13+
<ProjectReference Include="..\..\uis\AStar.Web\AStar.Web.csproj"/>
1414
</ItemGroup>
1515

1616
</Project>

src/aspire/AStar.Web.AppHost/AppHost.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1+
using Projects;
2+
13
var builder = DistributedApplication.CreateBuilder(args);
24

3-
var apiService = builder.AddProject<Projects.AStar_Web_ApiService>("apiservice")
5+
var apiService = builder.AddProject<AStar_Web_ApiService>("apiservice")
46
.WithHttpHealthCheck("/health");
57

6-
builder.AddProject<Projects.AStar_Web_Web>("webfrontend")
8+
builder.AddProject<AStar_Web>("webfrontend")
79
.WithExternalHttpEndpoints()
810
.WithHttpHealthCheck("/health")
911
.WithReference(apiService)

src/aspire/AStar.Web.ServiceDefaults/Extensions.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
using Microsoft.Extensions.DependencyInjection;
44
using Microsoft.Extensions.Diagnostics.HealthChecks;
55
using Microsoft.Extensions.Logging;
6-
using Microsoft.Extensions.ServiceDiscovery;
76
using OpenTelemetry;
87
using OpenTelemetry.Metrics;
98
using OpenTelemetry.Trace;
@@ -84,10 +83,7 @@ private static TBuilder AddOpenTelemetryExporters<TBuilder>(this TBuilder builde
8483
{
8584
var useOtlpExporter = !string.IsNullOrWhiteSpace(builder.Configuration["OTEL_EXPORTER_OTLP_ENDPOINT"]);
8685

87-
if (useOtlpExporter)
88-
{
89-
builder.Services.AddOpenTelemetry().UseOtlpExporter();
90-
}
86+
if (useOtlpExporter) builder.Services.AddOpenTelemetry().UseOtlpExporter();
9187

9288
// Uncomment the following lines to enable the Azure Monitor exporter (requires the Azure.Monitor.OpenTelemetry.AspNetCore package)
9389
//if (!string.IsNullOrEmpty(builder.Configuration["APPLICATIONINSIGHTS_CONNECTION_STRING"]))

src/modules/apis/AStar.Web.ApiService/AStar.Web.ApiService.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
</ItemGroup>
1212

1313
<ItemGroup>
14-
<ProjectReference Include="..\..\..\aspire\AStar.Web.ServiceDefaults\AStar.Web.ServiceDefaults.csproj" />
14+
<ProjectReference Include="..\..\..\aspire\AStar.Web.ServiceDefaults\AStar.Web.ServiceDefaults.csproj"/>
1515
</ItemGroup>
1616

1717
</Project>

0 commit comments

Comments
 (0)