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

using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using Shentun.Peis.EntityFrameworkCore;
using Shentun.Peis.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Shentun.Peis.DbMapping
{
internal class ChargePayDbMapping : IEntityTypeConfiguration<ChargePay>
{
public void Configure(EntityTypeBuilder<ChargePay> entity)
{
//entity.HasKey(e => new { e.ChargeId, e.PayModeId })
// .HasName("pk_department_charge_pay");
entity.HasComment("收费支付方式");
entity.Property(e => e.ChargeId).HasComment("收据号");
entity.Property(e => e.CardBillId).HasComment("会员卡ID");
entity.Property(e => e.PayModeId)
.HasComment("支付方式").IsRequired();
entity.Property(e => e.ChargeMoney).HasComment("金额").IsRequired();
entity.HasOne(d => d.Charge)
.WithMany(p => p.ChargePays)
.HasForeignKey(d => d.ChargeId)
.HasConstraintName("fk_charge_payment_mode_charge");
entity.HasOne(d => d.PayMode)
.WithMany(p => p.ChargePays)
.HasForeignKey(d => d.PayModeId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("fk_charge_");
entity.ConfigureByConvention();
}
}
}