This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Hi Guys,
I was looking for a work around to achieve this functionality. Basically, I have 3 tabls Company, Category and Product in my Model. Category has foreign key points to Compnay, Product has foreign key points to Category. What we are trying to achieve here is for a particular company, I want all products under "Wine" category. (this is not the real model of the project we are working on, it's a reflection of it)
var products = from c in UnitOfWorkScope.Current.Categories join p in UnitOfWorkScope.Current.Products on c.Id equals p.CategoryId where c.Name == "Wine" && c.CompanyId == companyId select p; as Join is not currently supported, what we came up something like this until your feedbackvar category = (from c in UnitOfWorkScope.Current.Categories where c.CompanyId == companyId && c.Name == "Wine" select c).SingleOrDefault(); if (category != null) { var products = from p in UnitOfWorkScope.Current.Products where p.CategoryId == category.Id select p; return products.ToList() ; } We are pretty sure there is a better way to achieve what we are trying to achieve, we are looking forward to hearing from you. (appologize for the format) |
|
|
Hmm, can't you just do: var products = from p in uow.Products Or am I missing something about the query? |
|
|
Hi Ivan,
It's exactly what we were looking for. Thanks heaps.
Nathan
|
|