-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathExpressionExtensions.cs
More file actions
40 lines (34 loc) · 1.07 KB
/
ExpressionExtensions.cs
File metadata and controls
40 lines (34 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// Copyright (C) 2019-2020 Xtensive LLC.
// This code is distributed under MIT license terms.
// See the License.txt file in the project root for more information.
using System.Linq.Expressions;
using Xtensive.Linq;
using Xtensive.Reflection;
namespace Xtensive.Orm.BulkOperations
{
internal static class ExpressionExtensions
{
public static bool IsContainsQuery(this Expression expression)
{
bool b = false;
expression.Visit(
delegate(Expression e) {
if (e.Type.IsOfGenericInterface(typeof (IQueryable<>)))
b = true;
return e;
});
return b;
}
#region Non-public methods
internal static object Invoke(this Expression expression)
{
return FastExpression.Lambda(
WellKnownMembers.FuncOfTResultType.CachedMakeGenericType(expression.Type), expression).Compile().DynamicInvoke();
}
internal static Expression Visit<T>(this Expression exp, Func<T, Expression> visitor) where T : Expression
{
return ExpressionVisitor<T>.Visit(exp, visitor);
}
#endregion
}
}