TrackedDm.cs 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. using Microsoft.EntityFrameworkCore;
  2. namespace Quadarax.Application.QLiberace.Common.Entities.Base.DaoMapper
  3. {
  4. public class TrackedDm<TEntity>: IdDm<TEntity> where TEntity : QlbrcEntityTracked
  5. {
  6. public override void Map(ModelBuilder builder)
  7. {
  8. if (builder == null) throw new ArgumentNullException(nameof(builder));
  9. base.Map(builder);
  10. builder.Entity<TEntity>(entity =>
  11. {
  12. entity.Property(e => e.Created).IsRequired()
  13. .HasColumnType("datetime")
  14. .HasDefaultValueSql("(getdate())")
  15. .HasComment("Record created timestamp");
  16. entity.Property(e => e.Modified)
  17. .HasColumnType("datetime")
  18. .HasComment("Record modified timestamp");
  19. entity.Property(e => e.Modifier)
  20. .HasMaxLength(100)
  21. .HasComment("Record modifier signature");
  22. }
  23. );
  24. }
  25. }
  26. }