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.
22 lines
683 B
C#
22 lines
683 B
C#
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
|
|
|
namespace EntityFrameworkCore.Jet.IntegrationTests.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);
|
|
|
|
}
|
|
|
|
|
|
}
|
|
} |