Reputation: 427
I have an MVC4 project using EF. I have set up my schema so that all searchable items have have a Table that relates them to a "Tags" table. I am wondering what is the most efficient way to do a full search across all table related to this "Tags" table. In addition I will want to do a search across the titles/names of the item in question. Not sure what is the best way to go about this.
I drew a little diagram of this schema:
Thanks for your help!
Upvotes: 1
Views: 497
Reputation: 2361
Pseudo code would look like:
var tagged = db.Products.Where(p => p.ProductTag.Any(pt => pt.Tag.Name.Contains("Search")));
But it would all depend on how your model is setup.
Upvotes: 1