c# - query base object based on a non related entity list using entity framework -


i have following model:

a workflowconfiguration has brand , has type. workflowconfiguration has collection of approvers. approvers entity has property status , username.

in part of application, have entity called requestbase entity has string property called currentstatus.

i need make query linq or ef lambda expressions returns me requests status matches username on approvers entity. know little bit complicated, or complicated, lol.

these entities(simplified)

public class requestbase     {         public int requestbaseid { get; set; }         public string currentstatus { get; set; }       }    public class workflowconfiguration     {         public int workflowconfigurationid { get; set; }         public workflowtype workflowtype { get; set; }         public brand brand { get; set; }         public virtual icollection<approver> approvers { get; set; }      }   public class approver     {         public approver()         {          }          public approver(string approverusername)         {             name = approverusername;         }          public int id { get; set; }         public string name { get; set; }         public string stepname { get; set; }  -----||||>>>>>> must match status?         public int order { get; set; }     } 

and query? not compile

return _context.requestbases.                         .where(a => a.currentstatus.any(workflowconfiguration.select(b=>b.approvers.select(c => c.stepname)))); 

_context.requestbases .where(rb => _context.workflowconfiguration     .any(wc => wc.approvers         .any(a => a.stepname == rb.currentstatus))); 

Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -