c# - Issues with Dynamic Search Expressions in EF -


i using data structures similar following:

public class individual {     //other properties omitted brevity sake      public list<individualname> individualnames {get; set;}             } 

and

public class individualname {     public string familyname {get; set;}     public string givenname {get; set;}     public string middlename {get; set;} } 

i attempting use dynamic search expressions pass presentation layer repository level (to apply search).

however, have run issues due fact individual can have 1-m individual names, , trying use linq grab of individual's individualnames can queried.

for example's sake - expression looks like:

searchexpressions.add(new searchexpression("individual                                            .individualnames                                            .select(givenname)                                            .firstordefault()"              , comparisonoperator.contains, "test"); 

this determine if givenname in first individualname instance contains "test". above works should - bit stuck in terms of how able determine if of individualnames contained string.

any appreciated - have tried several things without luck.

i think looking for....

searchexpressions.add(new searchexpression("individual                                             .individualnames                                             .select(givenname)",                       comparisonoperator.contains, "test"); 

you need add contains aggregate method dynamic linq library. how can found here. http://blog.walteralmeida.com/2010/05/advanced-linq-dynamic-linq-library-add-support-for-contains-extension-.html


Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -