References
External links
Kontakt 5 page at Kontakt.com
Download NI Komplete Kontrol
Category:Digital audio workstations
Category:Music software for Windows
Category:Samplers (musical instrument)
Category:Windows multimedia software
Category:Virtual instrumentsQ:
Alternative ways to retrieve a deep relationship using Entity Framework
I am trying to retrieve a deep relationship using Entity Framework and the below is what I tried:
public class MyClass
{
public virtual ICollection ChildClass { get; set; }
}
public class MyOtherClass
{
public virtual ICollection ChildClass { get; set; }
}
public class MyClassMap : ClassMap
{
public MyClassMap()
{
HasMany(x => x.ChildClass).KeyColumn("ChildClassID").Cascade.All();
}
}
public class MyOtherClassMap : ClassMap
{
public MyOtherClassMap()
{
HasMany(x => x.ChildClass).KeyColumn("ChildClassID").Cascade.All();
}
}
// Fluent API
modelBuilder.Entity()
.HasOptional(x => x.ChildClass)
.WithMany()
.HasForeignKey(x => x.ChildClassID)
.WillCascadeOnDelete(false);
// Working fine
_dbContext.MyClasses.Where(x => x.ID == 1)
.Include(x => x.ChildClass)
.FirstOrDefault();
However, I am getting the below exception:
Cannot insert explicit value for identity column in table 'MyClass' when IDENTITY_INSERT is set to OFF.
I understand that this is because there is no ChildClassID column in MyClass table. I want to know what are the alternative ways of doing this, with out having an IDENTITY_INSERT for Identity columns. I do not want to make any changes in the be359ba680
Related links:
Comments