CurrencyDm.cs 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. using Microsoft.EntityFrameworkCore;
  2. using Quadarax.Application.QLiberace.Common.Entities.Base.DaoMapper;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. namespace Quadarax.Application.QLiberace.Base.Entities.DaoMapper
  9. {
  10. public class CurrencyDm: TrackedDm<Currency>
  11. {
  12. public override void Map(ModelBuilder builder)
  13. {
  14. if (builder == null) throw new ArgumentNullException(nameof(builder));
  15. base.Map(builder);
  16. builder.Entity<Currency>(entity =>
  17. {
  18. entity.ToTable(Constants.Modules.Base.TblCurrency, Constants.Modules.Base.Schema);
  19. // indexes
  20. entity.HasIndex(e => e.Code, "IDX_CURRENCY_CODE")
  21. .IsUnique();
  22. // columns
  23. entity.Property(e => e.Code).IsRequired()
  24. .HasMaxLength(5)
  25. .HasComment("Currency code. Main key to search.");
  26. entity.Property(e => e.Name).IsRequired()
  27. .HasMaxLength(50)
  28. .HasComment("Currency name. Informational value.");
  29. entity.Property(e => e.Sign).IsRequired()
  30. .HasMaxLength(3)
  31. .HasComment("Currency sign chars");
  32. }
  33. );
  34. }
  35. }
  36. }