Copy and Paste to Visual Studio
In a C# app, my code is often:
DataClassesDataContext db = new DataClassesDataContext();
Then the Linq code is, for example
var results = from answer in db.Answers
where answer.Score > 20
select answer
Basically, this cannot be copied and pasted to / from LinqPad as the tables are in the DataContext. db. breaks linqPad / VS when it is copied back in.
Would be nice to be able to define the name of the DataContext globally (default), or for each query.
-
Richard commented
Thanks Joe, I guess what would make things really easy would be the ability to run this line before the expression automatically. Otherwise, I need to also add two lines (the var and the dump) and change the query type on every query I run.
-
There is a workaround: you can set the query type to statements and go:
var db = this;
Then you can use db in your queries.