public static Func<ReviewEntities, int, IQueryable<ProjTeamMemberDetails>>
GetTeamMembersByTeamId = CompiledQuery.Compile((ReviewEntities context, int teamId)
=> from tp in context.TeamPlayers
join t in context.Teams on tp.TeamId equals t.ID
join emp in context.Employees on tp.EmployeeId equals emp.ID
where tp.TeamId == teamId && emp.IsActive == true
orderby emp.JoiningDate
select new ProjTeamMemberDetails
{
EmployeeName = emp.FirstName + " " + emp.LastName,
Email = emp.Email,
Designation = context.Designations.FirstOrDefault(s => s.ID == emp.DesignationId).Name,
NIC = emp.NIC,
JoiningDate = emp.JoiningDate,
EmployeeID = emp.ID
})
This is my code to create a compiled query for ADO.Net entity model framework. In the syntax "
CompiledQuery.Complie((ReviewEntities", there is a strange error which say's
"The type 'ReviewEntities' cannot be used as type parameter 'TArg0' in the generic type or method 'System.Data.Linq.CompiledQuery.Compile(System.Linq.Expressions.Expression>)'. There is no implicit reference conversion from 'ReviewEntities' to 'System.Data.Linq.DataContext'."
I am unable to figure this out why this is creating error. It is not accepting first parameter that is DataContext.
Does Compiled query works in ADO.Net entity model or not?
Any help will be highly appreciated.