A generic method for compiled Linq queries
In some articles authors recommend use of compiled Linq for gaining performance benefits.
But the code for writing compiled Linq is not generic. Here is an example:
public static Func<DataContext, string, IQueryable<clsCustomerEntity>> getCustomers
As per this approach for every Linq method a separate function will be 开发者_开发问答required due to differences of input parameters. Please advice how such a generic function (complied Linq) can be used that can be used with different Linq to SQL calls.
Even if you had a generic method for creating compiled queries, it would not solve your root concern.
Each formulation of SQL text must be held by a seperate compiled query instance. If you have 10,000 different formulations of SQL text, you need 10,000 compiled query instances to hold them all. You will need some mechanism to track those 10,000 compiled query instances.
精彩评论