有关LINQ to SQL的简单问题
|
我不明白一件事。假设我已经有了这些编码实体:
[Table(Name = \"Rates\")]
public class Rate
{
private EntityRef<Product> _Product;
[Column(IsPrimaryKey = true)]
public String RateID
{ get; set; }
[Column]
public String ProductID
{ get; set; }
[Column]
public Double VolumeInTons
{ get; set; }
[Column]
public Decimal Volume
{ get; set; }
[Column]
public Decimal Cost
{ get; set; }
[Column]
public UInt32 Year
{ get; set; }
[Association(Storage = \"_Product\", OtherKey = \"ProductID\")]
public Product Product
{
get { return this._Product.Entity; }
set { this._Product.Entity = value; }
}
}
和
[Table(Name=\"Products\")]
public class Product
{
private EntitySet<Rate> _Rates;
[Column(IsPrimaryKey= true)]
public String ProductID
{ get; set; }
[Column]
public String Name
{ get; set; }
[Column]
public String Category
{ get; set; }
[Association(Storage=\"_Rates\", OtherKey=\"ProductID\")]
public EntitySet<Rate> Rates
{
get { return this._Rates; }
set { this._Rates.Assign(value); }
}
}
我是否应该有一个物理数据库连接到相同的表定义(在我的应用程序中使用datacontext)?
假设我已经创建了一个数据库。它应该包含相同的表定义还是LINQ to SQL
创建它们?
没有找到相关结果
已邀请:
1 个回复
抹持奠糙驰