Subquery is not supported in 'IsDeleted' type 'Entities.Product'

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

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

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

Any ideas?

+6
exception linq-to-sql
source share
1 answer

I believe that you are only allowed two filters in a subquery of one or two relations and can use only a specific set of expressions, described in detail here:
Where
Orderby
Thenby
OrderByDescending
ThenByDescending
Take

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

+1
source share

All Articles