I'm sure this is straight forward but I'm very new to entity queries and has probably been asked before.
What i need to to search for all business in my database where they have a category that exists in a collection of categories I have built up
IList<businessCategory> busCatList;
busCatList.Add(businessCategory.CreatebusinessCategory(1,"Tourism"));
busCatList.Add(businessCategory.CreatebusinessCategory(2,"Accomidation"));
busCatList.Add(businessCategory.CreatebusinessCategory(3,"Entertainment"));
busCatList.Add(businessCategory.CreatebusinessCategory(4,"Bar"));
busCatList.Add(businessCategory.CreatebusinessCategory(5,"Club"));
var items = Data.DBEntities.business.Where(b.businessCategory.Contains(busCatList) );
I know the syntax of the query is wrong but essentially what i what the query to do it pull out all the business where it has a category matching any of the categories in the busCatLsit
In my database one business can be linked to many categories
In SQL I would do
SELECT name FROM business
join businessCategoryRlnshp on businessCategoryRlnshp.businessID = business.ID
where categoryID in (1,2,3)