Where() method and many to many relationship with the entity framework -


i have 2 tables in database video , tags. video table has 3 fields : name, id , list of tags. tags table has 2 fields : tagname, tagid.

videoviewmodel model = new videoviewmodel {     videos = repository.getvideos                         .where(v => v.name.contains("apple")) }; 

now let's i've multiple videos there apple in name 1 of these has green it's tags.tagname how can proceed ?

suppose have videos defined in dbcontext db, try this

var result = db.videos.where(x => x.name.equals("apple"))                       .where(x => x.tags.count(y => y.tagname.equals("green")) == 1); 

Comments

Popular posts from this blog

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -

java - JavaFX 2 slider labelFormatter not being used -