c# - Filtering a query in Entity Framework based upon a child value -


i've got model set in entity framework (ef) there 2 tables, parent , child, in 1 many relationship. having trouble writing query linq trying retrieve single instance of parent while filtering upon field in parent , field in child. listed below:

var query = c in context.parenttable              c.isactive == true && c.childtable.name = "abc"              select c; 

unfortunately when try fails because no field named "name" appears available via intellisense when type c.childtable.

any guidance appreciated.

that correct because c.childtable not of child type entitycollection<child>. in order make query work, need modify this:

var query = p in context.parenttable              c in p.childtable              p.isactive == true                    && c.name == "abc"              select p; 

Comments

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -