Avatar of sbornstein2
sbornstein2 asked on

LINQ statement help should be rather simple

Hello all,

I am using entity framework and I have entities with navigation properties aka table keys.   I have the following statement:

var loans = _uow.Loans.GetAll().Where(loan => loan.PoolID == poolId
                   && loan.IsActive && (!loan.LoanWorkflows.All(lw => lw.LoanId == loan.LoanID && 
                         lw.PoolWorkflowId == poolWorkflow.PoolWorkflowId)));

This is not working as I am expecting.   So what I want is I want all active Loans from the Loans table that do not have a corresponding record in the LoanWorkflows table where Loan.LoanId = LoanWorkflow.LoanId and LoanWorkflow.PoolWorkFlowId = the passed in value I have above for that.   Also there might not be at all a LoanWorkflowId object it may be null but I think that would be handled.   My statement right now is not working right for example if I have a truncated LoanWorkflow table I am getting 0 loans back that is not right.

Thanks all.
C#.NET ProgrammingASP.NETLINQ Query

Avatar of undefined
Last Comment
Fernando Soto

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Fernando Soto

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
ASKER
sbornstein2

thank you
Fernando Soto

Not a problem, glad I was able to help.
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy