【发布时间】:2010-07-27 06:33:43
【问题描述】:
我有两个班级:
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 中将 realtions 添加到 CarsOfRichmen ?
这是个好习惯吗?
【问题讨论】:
标签: c# sql sql-server-2005