开发者

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. thank you

if(account.AccountID > 0)
{
   dc.Accounts.Attach(account, t开发者_如何学Crue);
}
else
{
   dc.Accounts.InsertOnSubmit(account);
}

dc.SubmitChanges();


Change InsertOnSubmit to Add.

Change SubmitChanges to SaveChanges.

There is no bool argument needed for Attach.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜