I am working on Compiled Queries
to improve the performance of the LINQ queries. I defined a separate class & written a function :-
public static Func<ApplicationDbContext, IQueryable<EmployeeDetail>>
CompliedQueryForEmployee =
CompiledQuery.Compile((ApplicationDbContext context) => from c in
context.tblEmployee select c);
If I use DataContext
above then while using the above function it gives error as Invalid arguments.
This is how I access the tables :-
using (var ctx = new ApplicationDbContext(schemaName))
{
....
ctx.tblEmployee.ToList();
}
Exactly how to write & use compiled Queries?