You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
EntityFrameworkCore.Jet/test/EFCore.Jet.Integration.Test/Model09/TwoMap.cs

22 lines
670 B
C#

using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace EFCore.Jet.Integration.Test.Model09
{
public class TwoMap : IEntityTypeConfiguration<Two>
{
public void Configure(EntityTypeBuilder<Two> builder)
{
builder.HasKey(t => new { t.Id, t.OneId });
builder.ToTable("Two");
//builder.HasRequired(t => t.One).WithMany(t => t.TwoList).HasForeignKey(t => t.OneId);
// Now has required is obtained setting OneId as required (not nullable)
builder.HasOne(t => t.One).WithMany(t => t.TwoList).HasForeignKey(t => t.OneId);
}
}
}