Skip to content

Commit

Permalink
Excluded a bunch of methods which are evaluated by mistake. (#328)
Browse files Browse the repository at this point in the history
  • Loading branch information
sdanyliv authored and MaceWindu committed May 18, 2023
1 parent 9831572 commit 5425070
Showing 1 changed file with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,12 @@ public virtual MappingSchema GetMappingSchema(
static readonly MethodInfo TagWithMethodInfo =
MemberHelper.MethodOfGeneric<IQueryable<object>>(q => q.TagWith(string.Empty));

static readonly MethodInfo AsSplitQueryMethodInfo =
MemberHelper.MethodOfGeneric<IQueryable<object>>(q => q.AsSplitQuery());

static readonly MethodInfo AsSingleQueryMethodInfo =
MemberHelper.MethodOfGeneric<IQueryable<object>>(q => q.AsSingleQuery());

static readonly MethodInfo ThenIncludeEnumerableMethodInfo =
MemberHelper.MethodOfGeneric<IIncludableQueryable<object, IEnumerable<object>>>(q => q.ThenInclude<object, object, object>(null!));

Expand Down Expand Up @@ -878,6 +884,11 @@ TransformInfo LocalTransform(Expression e)
break;
}

if (generic == AsSplitQueryMethodInfo || generic == AsSingleQueryMethodInfo)
{
return new TransformInfo(methodCall.Arguments[0], false, true);
}

if (typeof(ITable<>).IsSameOrParentOf(methodCall.Type))
{
if (generic.Name == "ToLinqToDBTable")
Expand All @@ -890,8 +901,9 @@ TransformInfo LocalTransform(Expression e)

if (typeof(IQueryable<>).IsSameOrParentOf(methodCall.Type) && methodCall.Type.Assembly != typeof(LinqExtensions).Assembly)
{
if (null == methodCall.Find(nonEvaluatableParameters,
(c, t) => t.NodeType == ExpressionType.Parameter && c.Contains(t)))
if (dc.MappingSchema.GetAttribute<ExpressionMethodAttribute>(methodCall.Type, methodCall.Method) == null
&& null == methodCall.Find(nonEvaluatableParameters,
(c, t) => t.NodeType == ExpressionType.Parameter && c.Contains(t) || t.NodeType == ExpressionType.Extension))
{
// Invoking function to evaluate EF's Subquery located in function

Expand Down

0 comments on commit 5425070

Please sign in to comment.