Witam, pojawił mi się taki dziwny błąd z mapowaniem:
Multiplicity conflicts with the referential constraint in Role 'MenuItem_MainMenu_Target' in relationship 'MenuItem_MainMenu'. Because all of the properties in the Dependent Role are non-nullable, multiplicity of the Principal Role must be '1'.
w kodzie:
public class MainMenuMapping : EntityTypeConfiguration<MainMenu>
{
public MainMenuMapping()
: base()
{
this.HasKey(e => e.Id).Property(e => e.Id).HasColumnName("Id");
this.Property(e => e.Title).HasColumnName("Title");
this.Property(e => e.Controller).HasColumnName("Controller");
this.Property(e => e.View).HasColumnName("View");
this.Property(e => e.Parameters).HasColumnName("Parameters");
this.ToTable("MainMenu");
}
}
public class MenuItemMapping : EntityTypeConfiguration<MenuItem>
{
public MenuItemMapping()
: base()
{
this.HasKey(e => e.Id).Property(e => e.Id).HasColumnName("Id");
this.Property(e => e.Parent).HasColumnName("Parent");
this.Property(e => e.Title).HasColumnName("Title");
this.Property(e => e.Controller).HasColumnName("Controller");
this.Property(e => e.View).HasColumnName("View");
this.Property(e => e.Parameters).HasColumnName("Parameters");
this.HasOptional(e => e.MainMenu).WithMany(x => x.MenuItem).HasForeignKey(e => e.Parent).WillCascadeOnDelete();
this.ToTable("MenuItem");
}
}
Wiecie jak to naprawić??