Is it possible to override the SQL generat开发者_如何学Goed by LINQ to SQL, for optimisation purposes?
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 ...");
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.
精彩评论