Menu
  • HOME
  • TAGS

EF Code First One-to-One AND One-to-Many mapping

c#,entity-framework,ef-code-first,ef-model-builder

I'm not sure what version of EF you are using, but newer versions won't allow you to do the type of mapping you're trying to do, you'll receive the following error: The navigation property 'Pictures' declared on type 'YourProject.Category' has been configured with conflicting multiplicities. So why is that? Let's...

HasMany and WithRequired extension methods not found

entity-framework,ef-model-builder

The Entity<T> method is generic (DbModelBuilder.Entity), so, you need to specify the T type you want to start your configuration, for example: public class Foo { public in Id{get;set;} public in BooId{get;set;} public virtual Boo Boo{get;set;} } public class Boo { public in Id{get;set;} public virtual ICollection<Foo> Foos{get;set;} } And...