I'm trying to build a dynamic search query that adds where clauses to a LINQ query dependant on user input. The code looks like so:
IObjectScope scope = ObjectScopeProvider1.GetNewObjectScope();
scope.Transaction.Begin();
var query = from x in scope.Extent<SalesPrice>()
select x;
if (SkuUid != null)
{
query =
from q in query
where q.SkuUid == SkuUid
select q;
}
if (SalesType != null)
{
query =
from q in query
where q.SalesType == SalesType
select q;
}
Unfortunately upon running it i get the following error:
Second Where not implemented: value(Telerik.OpenAccess.Query.ExtentQuery`1[SalesPrice]).Select(x => x).Where(q => (Convert(q.SkuUid) = value(SalesPrice+<>c__DisplayClass4).SkuUid)).Where(q => (Convert(q.SalesType) = Convert(value(SalesPrice+<>c__DisplayClass4).SalesType)))
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.NotSupportedException: Second Where not implemented: value(Telerik.OpenAccess.Query.ExtentQuery`1[SalesPrice]).Select(x => x).Where(q => (Convert(q.SkuUid) = value(SalesPrice+<>c__DisplayClass4).SkuUid)).Where(q => (Convert(q.SalesType) = Convert(value(SalesPrice+<>c__DisplayClass4).SalesType)))
Source Error:
|
Is this an error in your OpenAccess code?
Regards,
Richard.