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.