26ff8d9b4f
Set up repository with legacy .NET Framework 4.8 source (OLD/), new .NET 10 Blazor solution (NEW/), OpenSpec specifications, documentation, and project configuration.
85 lines
2.8 KiB
Markdown
85 lines
2.8 KiB
Markdown
# DI Extension Class Standardization Design
|
|
|
|
## Purpose
|
|
|
|
Standardize the naming and location of DI extension classes across all projects to follow Microsoft best practices.
|
|
|
|
## Decisions
|
|
|
|
| Decision | Choice |
|
|
|----------|--------|
|
|
| File name | `DependencyInjection.cs` |
|
|
| Location | Project root |
|
|
| Namespace | `Microsoft.Extensions.DependencyInjection` |
|
|
| Class naming | `{ProjectName}DependencyInjection` |
|
|
|
|
## Changes By Project
|
|
|
|
### JdeScoping.Api
|
|
- **From:** `ServiceCollectionExtensions.cs` (root)
|
|
- **To:** `DependencyInjection.cs` (root)
|
|
- **Class:** `ServiceCollectionExtensions` → `ApiDependencyInjection`
|
|
- **Method:** `AddWebApi` (unchanged)
|
|
|
|
### JdeScoping.DataAccess
|
|
- **From:** `Extensions/ServiceCollectionExtensions.cs`
|
|
- **To:** `DependencyInjection.cs` (root)
|
|
- **Class:** `ServiceCollectionExtensions` → `DataAccessDependencyInjection`
|
|
- **Method:** `AddDataAccess` (unchanged)
|
|
- **Cleanup:** Delete empty `Extensions/` folder
|
|
|
|
### JdeScoping.DataSync
|
|
- **From:** `DependencyInjection/ServiceCollectionExtensions.cs`
|
|
- **To:** `DependencyInjection.cs` (root)
|
|
- **Class:** `ServiceCollectionExtensions` → `DataSyncDependencyInjection`
|
|
- **Method:** `AddDataSyncServices` (unchanged)
|
|
- **Cleanup:** Delete empty `DependencyInjection/` folder
|
|
|
|
### JdeScoping.ExcelIO
|
|
- **From:** `ServiceCollectionExtensions.cs` (root)
|
|
- **To:** `DependencyInjection.cs` (root)
|
|
- **Class:** `ServiceCollectionExtensions` → `ExcelIODependencyInjection`
|
|
- **Method:** `AddExcelIO` (unchanged)
|
|
|
|
### JdeScoping.Infrastructure
|
|
- **From:** `Extensions/InfrastructureServiceExtensions.cs`
|
|
- **To:** `DependencyInjection.cs` (root)
|
|
- **Class:** `InfrastructureServiceExtensions` → `InfrastructureDependencyInjection`
|
|
- **Method:** `AddInfrastructure` (unchanged)
|
|
- **Cleanup:** Delete empty `Extensions/` folder
|
|
|
|
## Host Project
|
|
|
|
No changes required. `Program.cs` already uses the extension methods correctly:
|
|
|
|
```csharp
|
|
builder.Services.AddDataAccess(builder.Configuration);
|
|
builder.Services.AddInfrastructure(builder.Configuration);
|
|
builder.Services.AddDataSyncServices(builder.Configuration);
|
|
builder.Services.AddExcelIO(builder.Configuration);
|
|
builder.Services.AddWebApi(builder.Configuration);
|
|
```
|
|
|
|
Since method names are unchanged and namespace is `Microsoft.Extensions.DependencyInjection`, the Host compiles without modification.
|
|
|
|
## File Template
|
|
|
|
```csharp
|
|
namespace Microsoft.Extensions.DependencyInjection;
|
|
|
|
public static class {ProjectName}DependencyInjection
|
|
{
|
|
public static IServiceCollection Add{Feature}(
|
|
this IServiceCollection services,
|
|
IConfiguration configuration)
|
|
{
|
|
// registrations...
|
|
return services;
|
|
}
|
|
}
|
|
```
|
|
|
|
## Verification
|
|
|
|
After changes, run `dotnet build` to confirm all projects compile successfully.
|