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

Commit 83dafb8

Browse files
sdanylivMaceWindu
authored andcommitted
Excluded a bunch of methods which are evaluated by mistake. (#328)
1 parent 2264b9f commit 83dafb8

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
@@ -544,6 +544,12 @@ public virtual MappingSchema GetMappingSchema(
544544
static readonly MethodInfo TagWithMethodInfo =
545545
MemberHelper.MethodOfGeneric<IQueryable<object>>(q => q.TagWith(string.Empty));
546546

547+
static readonly MethodInfo AsSplitQueryMethodInfo =
548+
MemberHelper.MethodOfGeneric<IQueryable<object>>(q => q.AsSplitQuery());
549+
550+
static readonly MethodInfo AsSingleQueryMethodInfo =
551+
MemberHelper.MethodOfGeneric<IQueryable<object>>(q => q.AsSingleQuery());
552+
547553
static readonly MethodInfo ThenIncludeEnumerableMethodInfo =
548554
MemberHelper.MethodOfGeneric<IIncludableQueryable<object, IEnumerable<object>>>(q => q.ThenInclude<object, object, object>(null!));
549555

@@ -906,6 +912,11 @@ TransformInfo LocalTransform(Expression e)
906912
break;
907913
}
908914

915+
if (generic == AsSplitQueryMethodInfo || generic == AsSingleQueryMethodInfo)
916+
{
917+
return new TransformInfo(methodCall.Arguments[0], false, true);
918+
}
919+
909920
if (typeof(ITable<>).IsSameOrParentOf(methodCall.Type))
910921
{
911922
if (generic.Name == "ToLinqToDBTable")
@@ -918,8 +929,9 @@ TransformInfo LocalTransform(Expression e)
918929

919930
if (typeof(IQueryable<>).IsSameOrParentOf(methodCall.Type) && methodCall.Type.Assembly != typeof(LinqExtensions).Assembly)
920931
{
921-
if (null == methodCall.Find(nonEvaluatableParameters,
922-
(c, t) => t.NodeType == ExpressionType.Parameter && c.Contains(t)))
932+
if (dc.MappingSchema.GetAttribute<ExpressionMethodAttribute>(methodCall.Type, methodCall.Method) == null
933+
&& null == methodCall.Find(nonEvaluatableParameters,
934+
(c, t) => t.NodeType == ExpressionType.Parameter && c.Contains(t) || t.NodeType == ExpressionType.Extension))
923935
{
924936
// Invoking function to evaluate EF's Subquery located in function
925937

0 commit comments

Comments
 (0)