troubleshooting Question

LINQ statement help should be rather simple

Avatar of sbornstein2
sbornstein2 asked on
.NET ProgrammingC#ASP.NETLINQ Query
3 Comments1 Solution419 ViewsLast Modified:
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.
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 3 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros