62,272
社区成员
发帖
与我相关
我的任务
分享
[MetadataType(typeof(Product_MetaData))]
public partial class Product
{
public Product()
{
this.ProductGuid = Guid.NewGuid();
this.AddTime = DateTime.Now;
}
}
public class Product_MetaData
{
public int ID { get; set; }
public Guid ProductGuid { get; set; }
public string ProductName { get; set; }
public DateTime AddTime { get; set; }
}
var item =
from p in db.Product
where p.ProductGuid == id
select p;
foreach (var detail in item )
{
db.Product.DeleteOnSubmit(detail);
}
try
{
db.SubmitChanges();
}
catch (Exception e)
{
Console.WriteLine(e);
}