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.

45 lines
1.5 KiB

2 years ago
1 month ago
2 years ago
2 years ago
2 years ago
  1. using Microsoft.EntityFrameworkCore;
  2. using Microsoft.EntityFrameworkCore.Metadata.Builders;
  3. using Shentun.Peis.EntityFrameworkCore;
  4. using Shentun.Peis.Models;
  5. using System;
  6. using System.Collections.Generic;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Threading.Tasks;
  10. namespace Shentun.Peis.DbMapping
  11. {
  12. internal class ChargePayDbMapping : IEntityTypeConfiguration<ChargePay>
  13. {
  14. public void Configure(EntityTypeBuilder<ChargePay> entity)
  15. {
  16. //entity.HasKey(e => new { e.ChargeId, e.PayModeId })
  17. // .HasName("pk_department_charge_pay");
  18. entity.HasComment("收费支付方式");
  19. entity.Property(e => e.ChargeId).HasComment("收据号");
  20. entity.Property(e => e.CardBillId).HasComment("会员卡ID");
  21. entity.Property(e => e.PayModeId)
  22. .HasComment("支付方式").IsRequired();
  23. entity.Property(e => e.ChargeMoney).HasComment("金额").IsRequired();
  24. entity.HasOne(d => d.Charge)
  25. .WithMany(p => p.ChargePays)
  26. .HasForeignKey(d => d.ChargeId)
  27. .HasConstraintName("fk_charge_payment_mode_charge");
  28. entity.HasOne(d => d.PayMode)
  29. .WithMany(p => p.ChargePays)
  30. .HasForeignKey(d => d.PayModeId)
  31. .OnDelete(DeleteBehavior.ClientSetNull)
  32. .HasConstraintName("fk_charge_");
  33. entity.ConfigureByConvention();
  34. }
  35. }
  36. }