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:
Anatolii Grynchuk
2026-05-06 01:15:59 +03:00
parent 4fac3ddba9
commit 15c58522ef
15 changed files with 750 additions and 179 deletions
+47 -3
View File
@@ -1,9 +1,47 @@
namespace HrynCo.DAL.Abstract.Entities;
[Serializable]
public abstract class Entity<TId> : IEntity<TId> where TId : struct
public interface IEntity
{
DateTimeOffset Created { get; set; }
object Id { get; set; }
DateTimeOffset? Updated { get; set; }
}
public interface IEntity<TId> : IEntity where TId : struct
{
new TId Id { get; set; }
}
[Serializable]
public class Entity<TId> : IEntity<TId> where TId : struct
{
protected Entity()
{
}
public Entity(TId id)
{
Id = id;
}
public TId Id { get; set; }
object IEntity.Id
{
get => Id;
set
{
if (value is TId typedValue)
{
Id = typedValue;
}
else
{
throw new InvalidCastException($"Cannot cast value of type {value.GetType()} to {typeof(TId)}.");
}
}
}
public DateTimeOffset Created { get; set; }
public DateTimeOffset? Updated { get; set; }
}
@@ -17,7 +55,13 @@ public abstract class Entity : Entity<Guid>
}
protected Entity(Guid id)
: base(id)
{
Id = id;
}
}
[Serializable]
public abstract class NamedEntity : Entity
{
public required string Name { get; set; }
}