- Split `CatalogDto` into `CatalogReadDto` and `CatalogWriteDto` for clear separation of read/write operations in both backend and frontend. - Updated API controllers, services, and AutoMapper profiles to use new DTOs; ensured audit fields are set in service layer. - Enabled CORS in the API project to support Blazor WASM frontend. - Added new Blazor WebAssembly project (`DbFirst.BlazorWasm`) with catalog management UI, API client, Bootstrap v5.1.0 styling, and configuration-driven API base URL. - Included `bootstrap.min.css` and its source map for frontend styling and easier debugging. - Updated solution file to include new project and support multiple build configurations. - Result: improved API design, clean DTO separation, and a modern interactive frontend for catalog management.
15 lines
583 B
C#
15 lines
583 B
C#
using Microsoft.AspNetCore.Components.Web;
|
|
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
|
|
using DbFirst.BlazorWasm;
|
|
using DbFirst.BlazorWasm.Services;
|
|
|
|
var builder = WebAssemblyHostBuilder.CreateDefault(args);
|
|
builder.RootComponents.Add<App>("#app");
|
|
builder.RootComponents.Add<HeadOutlet>("head::after");
|
|
|
|
var apiBaseUrl = builder.Configuration["ApiBaseUrl"] ?? builder.HostEnvironment.BaseAddress;
|
|
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(apiBaseUrl) });
|
|
builder.Services.AddScoped<CatalogApiClient>();
|
|
|
|
await builder.Build().RunAsync();
|