Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I need to include an entity but with a condition #92

Open
itcozum opened this issue Dec 1, 2018 · 5 comments
Open

I need to include an entity but with a condition #92

itcozum opened this issue Dec 1, 2018 · 5 comments

Comments

@itcozum
Copy link

itcozum commented Dec 1, 2018

Hi,

I need some help running this; I need to include the second table with a condition like so;

DateTime _mydate = BusinessDaysUtility.ConvertFromDateTimeOffset(model.Today.Value.Date);

            var results = await _unitOfWork.GetRepository<PersonnelTable>().GetPagedListAsync(

            disableTracking: true,
            predicate: t => t.CompanyBranchId.Equals(model.CompanyBranchId) && t.Status == true,
            pageIndex: model.PageIndex, pageSize: model.PageSize,
            **include: source => source.Include(w => w.EmployeeCheckInCheckoutData.Where(c => c.CheckInDate.HasValue && c.CheckInDate.Value.LocalDateTime.Date.Equals(_mydate.Date) && c.IsDeleted != true)**
           ));

But I'm getting this error message:-

The Include property lambda expression 'w => {from EmployeeCheckInCheckoutData c in w.EmployeeCheckInCheckoutData where ((([c].CheckInDate != null) AndAlso Convert([c].CheckInDate, DateTimeOffset).LocalDateTime.Date.Equals(___mydate_Date_0)) AndAlso ([c].IsDeleted != True)) select [c]}' is invalid. The expression should represent a property access: 't => t.MyProperty'. To target navigations declared on derived types, specify an explicitly typed lambda parameter of the target type, E.g. '(Derived d) => d.MyProperty'.

please reply, this is the second time I'm asking for this help.

thanks in advance.

@rigofunc
Copy link
Member

rigofunc commented Dec 3, 2018

The prompt message had tell you how to do it

@itcozum
Copy link
Author

itcozum commented Dec 3, 2018

can u pls just help ??

@nellyigiebor
Copy link

this is very unfortunate that you've just DIS me for no reason, at list what ask of you is doable.

@itcozum
Copy link
Author

itcozum commented Dec 12, 2018

please I need your help about this subject.. adding where clause to include..

@chris-strauss
Copy link

@xyting can I get an example of how you got this to work properly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants