I have two classes:
public class RichMan
{
public string ID {get;set;}
List<Car> _cars=new List<Car>();
{
public List<Car> Cars
{
get
{
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
and CarsOfRichmen
idcar int (FK)
idrichman (FK)
If collection of cars of richamn would change how to do it on database ?
Delete all records from CarsOfRichmen where idrichman is id of my richam, and then in foreach add realtions to CarsOfRichmen ?
Is it good practice ?