Is it possible to override the SQL generated by LINQ to SQL, for optimisation purposes?
+2
A:
One way I have used:
Create a stored proc, use the linq to sql designer to drag the proc into the design surface. Call the resulting method instead.
BioBuckyBall
2010-02-05 04:18:23
+2
A:
You could use the ExecuteQuery method instead. This is useful if you want to leverage a function that's available in SqlServer but not in Linq (IE PIVOT, etc...)
For instance:
var query = db.ExecuteQuery<MyType>( @"SELECT ... FROM ... WHERE ...");
Nathan Koop
2010-02-06 15:56:00