Search code examples
c#entity-frameworklinq-to-entitieslinqpad

In LINQPad LinqToSql query with database context


I aways copy LINQtoSql query from code to LINQPad for testing, but it have a little inconvenient of this.

My code:

enter image description here

But when I copy it to LINQPad for testing:

enter image description here

LINQPad can't recognizing the database context "db", so I have to remove "db" manually.

Is there any way to solve this problem?


Solution

  • Start your query with the line

    var db = this;