Skip to content
This repository was archived by the owner on Feb 1, 2025. It is now read-only.

Commit 0df1083

Browse files
sdanylivMaceWindu
authored andcommitted
Excluded a bunch of methods which are evaluated by mistake. (#328)
1 parent 2092a29 commit 0df1083

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

Source/LinqToDB.EntityFrameworkCore/LinqToDBForEFToolsImplDefault.cs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -547,6 +547,12 @@ public virtual MappingSchema GetMappingSchema(
547547
static readonly MethodInfo TagWithMethodInfo =
548548
MemberHelper.MethodOfGeneric<IQueryable<object>>(q => q.TagWith(string.Empty));
549549

550+
static readonly MethodInfo AsSplitQueryMethodInfo =
551+
MemberHelper.MethodOfGeneric<IQueryable<object>>(q => q.AsSplitQuery());
552+
553+
static readonly MethodInfo AsSingleQueryMethodInfo =
554+
MemberHelper.MethodOfGeneric<IQueryable<object>>(q => q.AsSingleQuery());
555+
550556
static readonly MethodInfo ThenIncludeEnumerableMethodInfo =
551557
MemberHelper.MethodOfGeneric<IIncludableQueryable<object, IEnumerable<object>>>(q => q.ThenInclude<object, object, object>(null!));
552558

@@ -881,6 +887,11 @@ TransformInfo LocalTransform(Expression e)
881887
break;
882888
}
883889

890+
if (generic == AsSplitQueryMethodInfo || generic == AsSingleQueryMethodInfo)
891+
{
892+
return new TransformInfo(methodCall.Arguments[0], false, true);
893+
}
894+
884895
if (typeof(ITable<>).IsSameOrParentOf(methodCall.Type))
885896
{
886897
if (generic.Name == "ToLinqToDBTable")
@@ -902,8 +913,9 @@ TransformInfo LocalTransform(Expression e)
902913

903914
if (typeof(IQueryable<>).IsSameOrParentOf(methodCall.Type) && methodCall.Type.Assembly != typeof(LinqExtensions).Assembly)
904915
{
905-
if (null == methodCall.Find(nonEvaluatableParameters,
906-
(c, t) => t.NodeType == ExpressionType.Parameter && c.Contains(t)))
916+
if (dc.MappingSchema.GetAttribute<ExpressionMethodAttribute>(methodCall.Type, methodCall.Method) == null
917+
&& null == methodCall.Find(nonEvaluatableParameters,
918+
(c, t) => t.NodeType == ExpressionType.Parameter && c.Contains(t) || t.NodeType == ExpressionType.Extension))
907919
{
908920
// Invoking function to evaluate EF's Subquery located in function
909921

0 commit comments

Comments
 (0)