c# - Update database n:n -


i have 2 classes:

public class richman {  public string id {get;set;} list<car> _cars=new list<car>(); {     public list<car> cars     {                     {                     return this._cars;                 }                 set                 {                     this._cars = value;                     notifychanged("email");                 }      } 

}

and

public class car { public string id {get;set;} } 

and 3 tables:

richman  id int  cars: id int  , carsofrichmen  idcar int (fk) idrichman (fk) 

if collection of cars of richamn change how on database ?

delete records carsofrichmen idrichman id of richam, , in foreach add realtions carsofrichmen ?

is practice ?

no, it's not practice.

cars can have other linked information; changes in cars can trigger other actions.

you must add/delete/update relevant cars [edit] and/or carsofrichmen...


Comments

Popular posts from this blog

c++ - How do I get a multi line tooltip in MFC -

asp.net - In javascript how to find the height and width -

c# - DataTable to EnumerableRowCollection -