'variable '__deleted_0' of type 'System.Boolean' referenced from scope '', but it is not defined" in LINQKit
I have some troubles with using LINQKit library in order to include dynamic filters in my queries.
To begin with, I would like to share with a type of filter that is being sent to my query:
public Expression<Func<JobSpecificationDetail,bool>> Criteria { get; set; }
Next, I have my query which simply executes the following piece of code:
var queryTest = applicantCacheRepo
.AsNoTracking()
.Include(a => a.Profile)
.ThenInclude(p => p.ProfileEmployer)
.ThenInclude(p => p.Employer)
.Include(a => a.ProfileApplicationDetail)
.ThenInclude(p => p.ApplicationStatusSysCodeUnique)
.Include(a => a.Person)
.ThenInclude(p => p.PersonDetail)
.Include(a => a.JobSpecification)
.ThenInclude(j => j.JobSpecificationDetail)
.Where(a => filters.ManagerFilter.Invoke(a.Profile)
&& filters.ApplyDateFilter.Invoke(a.ProfileApplicationDetail)
&& filters.StatusDateFilter.Invoke(a.ProfileApplicationDetail)
&& filters.IsTopFilter.Invoke(a.ProfileApplicationDetail)
&& !a.ProfileApplicationDetail.ApplicationStatusSysCodeUnique.Deleted
&& a.Person.Deleted == false
&& a.Profile.Deleted == false
&& a.JobSpecification.JobSpecificationDetail
.Any(jd=>filters.JobSpecificationDetailSpec.Criteria.Invoke(jd)) //this line results in aforementioned exception
&& a.Profile.ProfileTypeSysCodeUniqueId == SysCodeUniqueId.ProfileType.EmployeeApplicant
&& !a.ProfileApplicationDetail.Deleted
).OrderByDescending(a => a.ApplyDate);
So, here in the query, the part which is indicated with a comment, throws that exception. I do not know what to do. In the query, you can find implementation of LINQKit methods as well. They do not create any problems.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
