39 lines
1.2 KiB
C#
39 lines
1.2 KiB
C#
using IRaCIS.Core.Domain.Models;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.EntityFrameworkCore.Metadata;
|
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
|
|
|
|
|
namespace IRaCIS.Core.Infra.EFCore.EntityConfigration
|
|
{
|
|
public class DoctorConfigration : IEntityTypeConfiguration<DoctorDictionary>
|
|
{
|
|
|
|
|
|
public void Configure(EntityTypeBuilder<DoctorDictionary> builder)
|
|
{
|
|
builder
|
|
.HasOne(dd => dd.Doctor)
|
|
.WithMany(p => p.DoctorDicRelationList)
|
|
.HasForeignKey(dd => dd.DoctorId);
|
|
|
|
builder
|
|
.HasOne(dd => dd.Dictionary)
|
|
.WithMany(d => d.DoctorDicRelationList)
|
|
.HasForeignKey(dd => dd.DictionaryId);
|
|
}
|
|
}
|
|
|
|
public class DictionaryConfigration : IEntityTypeConfiguration<Dictionary>
|
|
{
|
|
|
|
|
|
public void Configure(EntityTypeBuilder<Dictionary> builder)
|
|
{
|
|
builder.Property(e => e.MappedValue).Metadata.SetBeforeSaveBehavior(PropertySaveBehavior.Ignore);
|
|
builder.Property(e => e.MappedValue).Metadata.SetAfterSaveBehavior(PropertySaveBehavior.Ignore);
|
|
|
|
}
|
|
}
|
|
}
|