我有兩個類:更新數據庫N:N
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");
}
}
}
和
public class Car
{
public string ID {get;set;}
}
而且3個表:
RichMan
ID int
Cars:
ID int
and CarsOfRichmen
idcar int (FK)
idrichman (FK)
如果richamn的汽車收藏會改變如何在數據庫上做到這一點?
從CarsOfRichmen中刪除所有記錄,其中idrichman是我的richam的id,然後在foreach中將實現添加到CarsOfRichmen?
是不是很好的做法?
當一些富人賣掉他的汽車時,我不想在桌上汽車裏換車。 – user278618 2010-07-27 06:44:44