ExpressionExtensions
The extensions for Expression.
メソッド
public static IQueryable[] EnumerateSources(Expression expression)
result = ExpressionExtensions.EnumerateSources(expression)
Lists every queryable source names: the one it is composed over plus any a join or a sub-query brings in.
- expression
- The composed query.
戻り値: The distinct sources, in the order they appear.
public static object Evaluate(Expression e)
result = ExpressionExtensions.Evaluate(e)
Evaluates the expression and returns its value.
- e
- The expression to evaluate.
戻り値: The evaluated value.
public static T GetConstant<T>(Expression e)
result = ExpressionExtensions.GetConstant(e)
Gets the constant value from the expression.
- e
- The expression.
戻り値: The constant value.
public static MemberExpression GetInnerMember(MemberExpression exp)
result = ExpressionExtensions.GetInnerMember(exp)
Retrieves the innermost member in a nested member expression.
- exp
- The member expression to process.
戻り値: The innermost member expression.
public static object GetMemberValue(MemberInfo member, object instance)
result = ExpressionExtensions.GetMemberValue(member, instance)
Gets the value of the specified member from the given instance.
- member
- The member whose value to retrieve.
- instance
- The object instance from which to retrieve the value.
戻り値: The value of the member.
public static TValue GetValue<TValue>(Expression exp)
result = ExpressionExtensions.GetValue(exp)
Evaluates the expression and returns its value as the specified type.
- exp
- The expression to evaluate.
戻り値: The evaluated value converted to the specified type.
public static Expression PinSources(Expression expression, IQueryable[] sources)
result = ExpressionExtensions.PinSources(expression, sources)
Rebuilds so that every source it names is held in place, and reports the sources found.
- expression
- The composed query.
- sources
- The distinct sources, in the order they appear.
戻り値: The rebuilt expression, naming each source directly.
public static Expression ReplaceRootSource(Expression expression, IQueryable source)
result = ExpressionExtensions.ReplaceRootSource(expression, source)
Rebuilds over another source, so a query composed against one queryable runs against another.
- expression
- The composed query, e.g. a Where over a table.
- source
- The source to run it over instead, e.g. the same table held in memory.
戻り値: The rebuilt expression, or when it has no queryable root.
public static void ReplaceSource(Expression expression, IQueryProvider provider)
ExpressionExtensions.ReplaceSource(expression, provider)
Replaces the source provider in the expression with the specified query provider.
- expression
- The expression to modify.
- provider
- The query provider to set.
public static Expression ReplaceSources(Expression expression, IReadOnlyDictionary<object, IQueryable> sources)
result = ExpressionExtensions.ReplaceSources(expression, sources)
Rebuilds with each source it names replaced by the one mapped to it, so a query composed over database tables runs over held copies of them instead.
- expression
- The composed query.
- sources
- What to put in place of each source.
戻り値: The rebuilt expression.
public static Expression StripQuotes(Expression e)
result = ExpressionExtensions.StripQuotes(e)
Removes quote expressions from the given expression.
- e
- The expression to process.
戻り値: The unquoted expression.
public static ComparisonOperator ToOperator(ExpressionType type)
result = ExpressionExtensions.ToOperator(type)
Converts the given expression type to its equivalent ComparisonOperator.
- type
- The expression type.
戻り値: The corresponding ComparisonOperator.