diff --git a/Home.md b/Home.md index 91d3521..bd2d768 100644 --- a/Home.md +++ b/Home.md @@ -1 +1,69 @@ -C:\Users\agryn \ No newline at end of file +# hrynco-ef + +Reusable Entity Framework Core base library for HrynCo applications. + +## Solution + +The solution (`hrynco-ef.slnx`) contains two projects: + +| Project | Description | +|---|---| +| `HrynCo.DAL.Abstract` | Infrastructure-agnostic contracts: entities, repository interfaces, unit of work, transactions, pagination. No EF Core dependency. | +| `HrynCo.DAL.EF` | Entity Framework Core implementations of the abstract contracts. Depends on `HrynCo.DAL.Abstract` and EF Core. | + +The split allows consuming projects to reference only `HrynCo.DAL.Abstract` in domain/application layers, keeping those layers free of EF Core. + +## Packages + +### `HrynCo.DAL.Abstract` + +| Type | Description | +|---|---| +| `IEntity` / `IEntity` | Base entity contracts | +| `Entity` / `Entity` | Base entity implementations with auto-generated `Id` | +| `NamedEntity` | Entity with a `Name` property | +| `IUnitOfWork` | Unit of work interface with transaction support | +| `ITransaction` | Async transaction contract | +| `PagedResult` | Pagination result wrapper | + +### `HrynCo.DAL.EF` + +| Type | Description | +|---|---| +| `BaseRepository` | Base repository wrapping the EF repository (lazy) | +| `BaseEfRepository` | EF Core repository with full CRUD and `DbContext` access | +| `IEfRepository` | EF-specific repository interface | +| `EfUnitOfWork` | EF Core unit of work implementation | +| `EfTransactionAdapter` | Adapts EF transactions to `ITransaction` | + +## Usage + +Reference `HrynCo.DAL.Abstract` for contracts only (domain/application layers). +Reference `HrynCo.DAL.EF` for the full EF Core implementation (infrastructure layer). + +```csharp +// 1. Define your entity +public class Product : Entity +{ + public string Name { get; set; } = string.Empty; +} + +// 2. Implement your repository +public class ProductRepository : BaseEfRepository +{ + public ProductRepository(YourDbContext context) : base(context) { } +} + +// 3. Register in DI +services.AddScoped, ProductRepository>(); +services.AddScoped>(); +``` + +## Pages + +- [[Versioning]] — how versions are bumped and packages published +- [[Class-Diagram]] — full class and interface hierarchy + +## Related + +- [IT-642](https://yt.grynco.com.ua/issue/IT-642) — Extract `PagedResult` builder as reusable `IQueryable` extension \ No newline at end of file