Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Subquery is not supported on 'IsDeleted' of type 'Entities.Product'

I'm using Linq to SQL and trying to filter data using DataOptions and AssociateWith. I have a table called Products that has a primary key called Id and a flag called IsDeleted with sql-datatype bit.

When I use the following code I get "Subquery is not supported on 'IsDeleted' of type 'Entities.Product'" exception on AssociateWith method.

var context = new DataContext();
DataLoadOptions options = new DataLoadOptions();
options.AssociateWith<Product>(p => !p.IsDeleted);
context.LoadOptions = options;

Any ideas?

like image 702
mrtaikandi Avatar asked Jan 13 '09 08:01

mrtaikandi


1 Answers

I believe that you are only allowed two filter on a subquery of a one->many relationship and can only use a specific set of expressions, detailed here:
Where
OrderBy
ThenBy
OrderByDescending
ThenByDescending
Take

(more info here http://msdn.microsoft.com/en-us/library/bb534221.aspx)

like image 110
Mustafakidd Avatar answered Oct 20 '22 01:10

Mustafakidd