[英]How to convert Linq to SQL to Linq Entity?
hi I have the code below could you help me please to rewrite from LINq to SQL to Linq to Entity. 嗨,我有下面的代码,您能帮我从LINq重写为SQL到Linq重写为Entity吗? thank you 谢谢
if(account.AccountID > 0)
{
dc.Accounts.Attach(account, true);
}
else
{
dc.Accounts.InsertOnSubmit(account);
}
dc.SubmitChanges();
Change InsertOnSubmit
to Add
. 将InsertOnSubmit
更改为Add
。
Change SubmitChanges
to SaveChanges
. 将SubmitChanges
更改为SaveChanges
。
There is no bool
argument needed for Attach
. Attach
不需要bool
参数。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.