linq - LinqKit PredicateBuilder with EF 4 CPT 5 table relationships? -


i'm using linqkit predicatebuilder (http://www.albahari.com/nutshell/predicatebuilder.aspx) method searching. how relationships built (entity framework 4 cpt 5 poco):

public class musicsheet {     [key]     public int id { get; set; }     public string title { get; set; }     public string key { get; set; }      public virtual icollection<author> authors { get; set; } }  public class author {     [key]     public int id { get; set; }     public string name { get; set; }     public string bio { get; set; }      public virtual icollection<musicsheet> musicsheets { get; set; } } 

i need able build predicate checks musicsheet (the title contains specific search term) name or bio of author might contain search term. here have:

var predicate = predicatebuilder.false<musicsheet>(); foreach (var term in terms) {     string keyword = term;      predicate = predicate     .or(s => s.title.contains(keyword));     // todo check author name & bio } 

any suggestions? thank much.

have tried this:

var predicate = predicatebuilder.false<musicsheet>(); foreach (var term in terms) {    string keyword = term;     predicate = predicate       .or(s => s.title.contains(keyword) ||                s.authors.any (a => a.name.contains(keyword) || a.bio.contains(keyword))); } 

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) -