feat: rebuild base repository hierarchy, add readme and agents
- replace EfRepository/BaseDbContext/UtcValueConverter with BaseEfRepository and BaseRepository - add IEfRepository interface hierarchy - consolidate IEntity into Entity.cs, remove standalone IEntity.cs - add PagedResult - adjust all namespaces to HrynCo.DAL.Abstract / HrynCo.DAL.EF - add README.md with solution overview, versioning rules, class diagram - add AGENTS.md Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
namespace HrynCo.DAL.EF.Core;
|
||||
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using HrynCo.DAL.Abstract.Entities;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
[SuppressMessage("Major Code Smell", "S2436:Reduce the number of generic parameters",
|
||||
Justification = "Generic design is intentional and improves reusability")]
|
||||
public abstract class BaseRepository<TEfRepository, TDbContext, TEntity, TEntityId>
|
||||
where TEntity : class, IEntity<TEntityId>
|
||||
where TDbContext : DbContext
|
||||
where TEfRepository : BaseEfRepository<TDbContext, TEntity, TEntityId>
|
||||
where TEntityId : struct
|
||||
{
|
||||
private readonly Lazy<TEfRepository> _lazyEfRepository;
|
||||
|
||||
protected BaseRepository()
|
||||
{
|
||||
_lazyEfRepository = new Lazy<TEfRepository>(CreateEfRepository);
|
||||
}
|
||||
|
||||
protected TEfRepository EfRepository => _lazyEfRepository.Value;
|
||||
|
||||
protected abstract TEfRepository CreateEfRepository();
|
||||
}
|
||||
Reference in New Issue
Block a user