.NET MVC4, Entity, Search

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!

Answers


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.


Need Your Help

How to combine results from multiple tables with different columns?

php mysql join union

I have several tables with different numbers and types of columns, and a single column in common.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.