58

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);
Kara
  • 6,115
  • 16
  • 50
  • 57
bangoo
  • 668
  • 1
  • 8
  • 14

2 Answers2

80

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();
}
D.R.
  • 20,268
  • 21
  • 102
  • 205
Erwin
  • 3,060
  • 26
  • 24
17

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()

KyleMit
  • 30,350
  • 66
  • 462
  • 664
Adrian Grigore
  • 33,034
  • 36
  • 130
  • 210