c# - Entity framework trouble -
i need setup one-to-many relationship entity framework.
i trying build recipe, recipe can composed of recipes.
how achieve ef ?
public class recipe { public recipe() { deleted = false; recipes = new list<recipe>(); } [key] public int recipeid { get; set; } public virtual list<recipe> recipes { get; set; } }
i don't need whole recursive thing(parent, child) child i'm interested in. feasible using ef ? can point me right direction
ex:
recipe a
recipe b => a
recipe c
recipe d => b
recipe e => b, c
this many-to-many relationship, because each recipe can have multiple , multiple parent recipes. when create child recipes, have assign parent it, must define parent relationship well.
you try inverseproperty dataannotation, more info check out question: entity framework 4.1 inverseproperty attribute
Comments
Post a Comment