How to submit changes in LinqPad

天涯浪子 提交于 2019-12-03 08:11:04

问题


I have a problem with committing changes in LinqPad. I am using Oracle database over IQ driver in LinqPad. I can retrieve data but I don't know how to submit changes to database.

I retrieve data from database:

 var items = Asyncqueue.Where(x => ids.Any(y=> y == x.Asyncqueueid));
 // then I have to fix data 

I have tried to set submit action like this:

 Asyncqueue.SetSubmitAction(items, SubmitAction.Update);

回答1:


Change Language in LINQPad to "C# Program" and use the following code

void Main()
{
    var p1 = Person.Single(x => x.Id == 1);
    p1.Name = "Test";
    SubmitChanges();
}



回答2:


If you are using an EF Context, then you need to call SaveChanges()

If you are using a Linq2Sql context, then you need to call SubmitChanges()



来源:https://stackoverflow.com/questions/18438924/how-to-submit-changes-in-linqpad

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!