You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
1.2 KiB

2 years ago
  1. using Microsoft.EntityFrameworkCore.Metadata.Builders;
  2. using Microsoft.EntityFrameworkCore;
  3. using Shentun.Peis.Models;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using Shentun.Peis.EntityFrameworkCore;
  10. namespace Shentun.Peis.DbMapping
  11. {
  12. internal class ColumnReferenceDbMapping : IEntityTypeConfiguration<ColumnReference>
  13. {
  14. public void Configure(EntityTypeBuilder<ColumnReference> entity)
  15. {
  16. entity.HasComment("字段对照主表");
  17. entity.Property(t => t.DisplayName).HasComment("名称").IsRequired();
  18. entity.Property(t => t.ColumnReferencePlugInsId).HasComment("插件ID").IsRequired();
  19. entity.Property(e => e.Id)
  20. .IsFixedLength()
  21. .HasComment("编号").HasColumnName("id");
  22. entity.HasOne(d => d.ColumnReferencePlugIns)
  23. .WithMany(p => p.ColumnReferences)
  24. .HasForeignKey(d => d.ColumnReferencePlugInsId)
  25. .OnDelete(DeleteBehavior.ClientSetNull)
  26. .HasConstraintName("fk_columnreference_columnreferenceplugins");
  27. entity.ConfigureByConvention();
  28. }
  29. }
  30. }