.net - How to add child object in parent object in EF -


work on ef4.

i know ef objectcontext can 3 properties involved in parent-child association, 2 navigation properties (parent.children, child.parent) , foreign key property (child.parentid). need on parent.childer navigation.

private list<t2> fillchildcontrolonsave<t1, t2>(bommastercontroller objcontroller, list<t2> entitydetail, t1 objentity)             t1 : plnbommaster             t2 : plnbomdetail {     #region myregion              #endregion      foreach (t2 c in entitydetail)     {         if (c.action == xerp.entity.actionmode.add)         {             objentity.plnbomdetails.add(c);         }          if (c.action == xerp.entity.actionmode. update)         {             objentity.plnbomdetails.add(c);         }     } } 

want replace objentity.plnbomdetails.add(c); generic objentity.###<t2>.add(c);. me writa generic syntax above add , update condition . if have question please ask, type of suggestion acceptable.thanks in advanced.


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -