Code: Select all
select A.*
from TableA as A
join
(
select 1 as Value
union all
select 2 as Value
union all
select 3 as Value
union all
...
union all
select 9999 as Value
) as B
on A.SomeField = B.Value
Code: Select all
///
/// Returns the records of the given iq which have the tableField set to the one of the values of the given selection."selectionFieldSelector"
///
///
///
///
/// The records of which to return a subset
/// The field to filter on
/// The filter values
/// The selector for the field of the filter values
///
public static IQueryable InPro(this IQueryable iq
, Expression> tableField
, IList selection
, Expression> selectionFieldSelector)
where T : class
where U : class
//where V: class
{
IQueryable result = iq;
List ids = selection.Select(selectionFieldSelector.Compile()).ToList();
if (ids.Count == 0) return result.Where(x => false);
result = result.Join(ids, tableField, y => y, (a,b) => a);
return result;
}
Code: Select all
private List AuxFillRegelsVertrekdeuren(List routedagen)
{
return ((AppDataContext)_controller.GetDataContext()).Vertrekdeurs
.InPro(x=>x.RouteDag, routedagen, y=>y.Id)
.Cast().ToList();
}
Is this by design or a bug? And why shouldn't this just work, because it can easily be converted to the SQL which I showed.System.NotSupportedException: Constant cannot be sequences.
bij Devart.Data.Linq.Provider.Query.u.a(SqlNode A_0)
bij Devart.Data.Linq.Provider.Query.u.a(Expression A_0)
bij Devart.Data.Linq.Provider.Query.u.a(Expression A_0, Expression A_1, LambdaExpression A_2, LambdaExpression A_3, LambdaExpression A_4)
bij Devart.Data.Linq.Provider.Query.u.b(MethodCallExpression A_0)
bij Devart.Data.Linq.Provider.Query.u.j(Expression A_0)
bij Devart.Data.Linq.Provider.Query.u.a(Expression A_0)
bij Devart.Data.Linq.Provider.Query.u.d(Expression A_0, Expression A_1)
bij Devart.Data.Linq.Provider.Query.u.b(MethodCallExpression A_0)
bij Devart.Data.Linq.Provider.Query.u.j(Expression A_0)
bij Devart.Data.Linq.Provider.Query.u.a(Expression A_0, Type A_1)
bij Devart.Data.Linq.Provider.Query.u.b(MethodCallExpression A_0)
bij Devart.Data.Linq.Provider.Query.u.j(Expression A_0)
bij Devart.Data.Linq.Provider.Query.u.i(Expression A_0)
bij Devart.Data.Linq.Provider.DataProvider.BuildQuery(Expression query)
bij Devart.Data.Linq.Provider.DataProvider.Devart.Data.Linq.Provider.IProvider.Compile(Expression query)
bij Devart.Data.Linq.DataQuery`1.i()
bij System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
bij System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
bij Jumbo.Juist.Models.Overzicht.AuxFillRegelsVertrekdeuren(List`1 routedagen) in D:\Projects\JUIST\Juist\Juist\Models\Overzicht.cs:regel 458
[...]
A less then ideal alternative I use today is partitioning by 1000 and using .Skip(n*1000).Take(1000). Any better alternatives?
Kind regards,
Edwin.