.net - Entity Framework 4, defining relationship -


when defining relationship in entity framework 4 in 1-to-many relationship using poco classes why relationship have defined @ child level. example have order has many products. relationship in mapping file product like:-

    relationship(e => e.order)             .fromproperty(m => m.product)             .hasconstraint((e, m) => e.id == m.id); 

in n-hibernate defined in mapping file @ parent level (order in case). having relationship defined @ parent offers more flexibility , reuse.

is there way @ parent level instead in ef4.

in ef4 ctp2 have inverse properties. mentioned in ado.net team blog post.

 public parentconfiguration()         {             property(p => p.id).isidentity();             property(p => p.firstname).isrequired();             property(p => p.lastname).isrequired();              //register inverse             relationship(p => p.children).fromproperty(c => c.parents);         } 

what means parent.children = children work same child.parents.add(parent).

i have not seen way nhibernate can apply attribute\meta data directly parent class. in experience working poco "plain old clr objects" separate orm framework. relationships defined objectcontext in ef , managed there.


Comments

Popular posts from this blog

ruby - When to use an ORM (Sequel, Datamapper, AR, etc.) vs. pure SQL for querying -

php - PHPDoc: @return void necessary? -

c++ - Convert big endian to little endian when reading from a binary file -