6be7a0ceed
- add non-generic IEntity with Created/Updated only - IEntity<TId> now extends IEntity - remove Created = DateTimeOffset.UtcNow from Entity constructor - add BaseDbContext with ApplyTimestamps, UtcValueConverter, DeleteBehavior.Restrict - add UnexpectedEntityStateException - add HrynCo.Common dependency to HrynCo.DAL.EF Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
24 lines
445 B
C#
24 lines
445 B
C#
namespace HrynCo.DAL.Abstract.Entities;
|
|
|
|
[Serializable]
|
|
public abstract class Entity<TId> : IEntity<TId> where TId : struct
|
|
{
|
|
public TId Id { get; set; }
|
|
public DateTimeOffset Created { get; set; }
|
|
public DateTimeOffset? Updated { get; set; }
|
|
}
|
|
|
|
[Serializable]
|
|
public abstract class Entity : Entity<Guid>
|
|
{
|
|
protected Entity()
|
|
{
|
|
Id = Guid.NewGuid();
|
|
}
|
|
|
|
protected Entity(Guid id)
|
|
{
|
|
Id = id;
|
|
}
|
|
}
|