Enforce business rules for catalog title changes: only allow CatTitle to be edited when UpdateProcedure permits, with checks in the API, service, handler, and UI. This ensures consistent validation and user experience across backend and frontend.
Enforce immutability of CatTitle on updates: backend now rejects title changes with a BadRequest, and frontend disables the title input field when editing.
Added CatalogUpdateProcedure enum to domain. CatalogWriteDto now includes UpdateProcedure property in both application and BlazorWasm layers. Catalogs.razor form allows users to choose between PRTBMY_CATALOG_UPDATE and PRTBMY_CATALOG_SAVE when editing. Repository, service, and handler layers updated to pass and use the selected procedure. Default remains Update. Updated comments and TODOs for clarity and future refactoring.
Added Copilot comments explaining why a generic repository is unsuitable due to stored procedure complexities and asymmetric CRUD operations. Suggested keeping specialized repositories and extracting helpers for reuse. Also added a TODO to move the interface to the application layer for clean architecture.
Added detailed comments in CatalogService and ICatalogService explaining why a generic CRUD base service or repository is not suitable for this solution, due to entity-specific domain logic and stored procedure usage. Removed the previous Copilot comment from CatalogRepository. No functional changes; updates are for architectural clarity.
Replaced direct service usage in CatalogsController with MediatR-based commands and queries for all CRUD operations. Added command/query and handler classes for Catalog operations. Updated dependency injection to register MediatR and removed ICatalogService. Improved code maintainability and testability by adopting CQRS architecture.
Expanded using directives to support additional dependencies in CatalogRepository.cs. Added a detailed comment explaining why per-entity repository implementations are preferred over a generic CRUD base service in this context, due to unique domain logic and stored procedure requirements. No functional code changes were made.
Refactored dependency injection by introducing AddApplication and AddInfrastructure extension methods for service registration. Moved DbContext and AutoMapper setup out of Program.cs to improve modularity and reusability. Added required NuGet packages to .csproj files.
Introduce CORS configuration using allowed origins from appsettings.json. Updated Program.cs to read allowed origins from configuration and apply them to the CORS policy, defaulting to AllowAnyOrigin if none are specified. Also made minor formatting and comment improvements.
Introduced ExceptionHandlingMiddleware to catch and log unhandled exceptions, returning standardized JSON error responses. Registered the middleware in the request pipeline. Also made minor formatting and comment improvements in Program.cs and ICatalogRepository.cs.
Refactored CatalogApiClient methods to return ApiResult<T> for create, update, and delete operations, enabling more detailed error reporting. Introduced ApiResult<T> and ProblemDetailsDto types, and added logic to parse and display informative error messages. Updated Catalogs.razor to use the new pattern and show user-friendly error feedback. Added necessary using directives.
The Update method now checks if CatTitle is being changed and returns a 400 Bad Request if so. It also returns 404 Not Found if the catalog does not exist before attempting an update. This ensures CatTitle remains immutable during updates.
Configured CORS support with a default policy that allows requests from any origin. Added a TODO to restrict allowed origins using values from appsettings.json in the future.
Added ApplicationDbContext and AutoMapper registrations to the DI container in Program.cs. Included TODO comments to extract these registrations into extension methods for better reuse across projects.
Added a uniqueness check for catalog titles in the creation flow. The service now prevents creating catalogs with duplicate titles by checking for existing entries before insertion. If a duplicate is detected, the API returns a 409 Conflict response. Updated interfaces and repository to support title-based lookups.
Added TODO comments in Program.cs for exception handling middleware, and in CatalogService.cs and ICatalogService.cs for creating a generic service and implementing CQRS with MediatR. No functional changes made.
Added TODO comments in ICatalogRepository and CatalogRepository to suggest adopting a generic repository pattern to reduce code duplication. Also noted the potential move of the interface to the application layer for better adherence to clean architecture principles.
Added a TODO comment in ApplicationDbContext to suggest configuring column names using IConfiguration and appsettings. No functional changes were made.
Added Microsoft.Data.SqlClient using directive to CatalogRepository.cs. Also added a TODO comment suggesting the use of a generic repository pattern to minimize code duplication.
Refactored CatalogRepository to set @GUID as an OUTPUT parameter when calling PRTBMY_CATALOG_UPDATE. Now, after execution, the code checks the returned GUID value and uses it to fetch the updated catalog entry, handling cases where the GUID is null or zero. This ensures the repository returns the correct catalog record as modified by the stored procedure.
Replaced the InsertAsync placeholder with a full implementation that inserts a new VwmyCatalog using the dbo.PRTBMY_CATALOG_INSERT stored procedure. The method sets up SQL parameters, handles the output GUID, and retrieves the inserted catalog from the view. Exceptions are thrown if the insert fails or the catalog cannot be loaded.
Removed ReverseMap from CatalogProfile for one-way mapping. Refactored UpdateAsync in CatalogRepository: eliminated existence check, set @GUID as input only, removed output handling, and simplified return logic.
Removed Upsert endpoint and related service/repository methods. Deleted ExecuteUpsertAsync helper. Insert now throws NotImplementedException as a placeholder. Refactored Delete method in repository; logic unchanged.
Replaced all usage of the Catalog entity with VwmyCatalog across application, domain, and infrastructure layers. Updated AutoMapper profiles, repository interfaces, and service logic to use VwmyCatalog. Removed the obsolete Catalog entity and related mapping profiles. Moved VwmyCatalog to the Domain.Entities namespace and cleaned up project structure. This change simplifies the domain model and eliminates redundant entity definitions.
Removed direct usage of TbmyCatalog entity and DbSet. All create, update, and delete operations now use stored procedures. Entity lookups and mappings are performed via the VwmyCatalog view. Updated AutoMapper profile and DbContext configuration accordingly. Catalog creation now sets ChangedWho/ChangedWhen to "system" and current UTC time.
Cleaned up Program.cs by removing unnecessary using directives
for AutoMapper, DbFirst, and EntityFrameworkCore namespaces.
This reduces clutter and improves code maintainability.
- 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.
Introduce VwmyCatalog as a keyless entity mapped to the VWMY_CATALOG database view. Update ApplicationDbContext to include the new DbSet and configure its mapping. Modify CatalogRepository to query the view instead of the table for GetAllAsync and GetByIdAsync. Add AutoMapper configuration for VwmyCatalog to Catalog. Add the VwmyCatalog entity class.
Refactor UpdateWithStoredProcedure to accept id from the route and set dto.Guid accordingly. In the repository, use Guid for existence checks instead of CAT_TITLE, and ensure CatTitle is not changed via the SP. Improve error handling to return NotFound when appropriate.
Added support for updating and deleting Catalog records via SQL Server stored procedures. Introduced PUT /catalogs/sp and DELETE /catalogs/sp/{id} endpoints in CatalogsController. Extended service and repository interfaces and implementations to handle stored procedure operations. Added Microsoft.Data.SqlClient package for direct SQL execution. Repository checks for record existence before SP calls to prevent unintended behavior.
Set up multi-project solution with DbFirst API, Application, Domain, and Infrastructure layers. Implemented database-first EF Core for the Catalog entity, including domain, DTOs, repository, service, and controller. Configured AutoMapper, DI, Swagger, and project settings. Added .gitattributes and initial configuration files.