开发者

How to convert Linq to SQL to Linq Entity?

开发者 https://www.devze.com 2023-01-14 16:30 出处:网络
hi I have the code below could you help me please to rewrite from LINq to SQL to Linq to Entity. thank you

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

精彩评论

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