# eShopModernized.Catalog — Catalog Item Management (.NET 8)

Modernized **Catalog Item Management** feature, refactored from `eShopLegacyMVC`
(ASP.NET MVC 5 / EF6 / .NET Framework) to **.NET 8 ASP.NET Core MVC + EF Core 8**,
following the in-repo `eShopPorted` conventions.

Generated by the one-modernizer pipeline from:
- spec: `.migration/decompose/catalog-item-management/spec.json`
- blueprint/mapping: `.migration/architect/catalog-item-management/`

## Structure

```
eShopModernized.Catalog/        ASP.NET Core MVC app (catalog-service)
  Controllers/CatalogController.cs
  Services/                     ICatalogService, CatalogService, CatalogServiceMock
  Models/                       CatalogItem, CatalogBrand, CatalogType, CatalogDBContext
  Models/Config/                IEntityTypeConfiguration mappings
  Models/Infrastructure/        PreconfiguredData, CatalogIdGenerator (HiLo)
  ViewModel/                    PaginatedItemsViewModel
  Middleware/                   GlobalExceptionHandlerMiddleware
  Views/Catalog/                Index, Details, Create, Edit, Delete
eShopModernized.Catalog.Tests/  xUnit + FluentAssertions + EF InMemory
```

## Run

```bash
# DB-free demo mode (in-memory data)
dotnet run --project eShopModernized.Catalog            # uses appsettings.Development.json (UseMockData=true)

# With SQL Server
dotnet ef migrations add Initial --project eShopModernized.Catalog
dotnet ef database update --project eShopModernized.Catalog
dotnet run --project eShopModernized.Catalog

# Tests
dotnet test

# Containerized (app + SQL Server)
docker compose up --build
```

## Config

| Key | Meaning |
| --- | ------- |
| `ConnectionStrings:CatalogDb` | SQL Server connection |
| `UseMockData` | `true` = in-memory (no DB); `false` = EF Core + SQL Server |

## Behavioral parity & deliberate follow-ups

This is a parity-first refactor (see `.migration/implement/catalog-item-management/constitution.md`).
Deferred ADR enhancements: FluentValidation, request DTOs, optimistic-concurrency
`rowversion`, and authentication — tracked as follow-up work.

> EF Core migrations are not committed (the generating environment had no .NET SDK).
> Run `dotnet ef migrations add Initial` once to generate the schema (sequence
> `catalog_hilo` + seed data are declared in `OnModelCreating`/configs).
