Execcuting a SQL Query within LinqPad Program - any way to use the Program's data context?
Options
I've got a LINQPad program, with various linq queries, etc. If I want to place a SQL query in the midst is there a way to do that and still use the existing data context or do I need to define a SQLConnection and provide my own connection string etc etc.
Comments
-
Using Nutshell.mdf
var query = @"SELECT * FROM Customer WHERE ID > {0}"; this.ExecuteQuery(typeof(Customer), query, 3).Dump();
-
That is cool - thanks! I could not find ExecuteQuery before you mentioned it - appreciate it.
-
No problem. Glad to help!
-
So, just to clarify, when you're using a data context (e.g. OP's case, Entity Framework, etc), `this` is the context itself.