Class DynXHelper
Dynamic expression helper
public static class DynXHelper
- Inheritance
-
DynXHelper
- Inherited Members
Methods
AsDelegate(MethodInfo, object?)
Converts methodInfo into a delegeate
public static Delegate AsDelegate(this MethodInfo methodInfo, object? target = null)
Parameters
methodInfoMethodInfotargetobject
Returns
BuildExpression(string, ParameterExpression, Type, IReadOnlyDictionary<string, object>, IReadOnlyDictionary<string, Type>)
Parse the expression with access to the public properties of ctxType (and funcLib) returning retType
into a Expression that takes ctxType (the context object) as parameter.
public static DynXHelper.ContextExpression BuildExpression(string expression, ParameterExpression ctxType, Type retType, IReadOnlyDictionary<string, object> funcLib, IReadOnlyDictionary<string, Type> ctxConverter)
Parameters
expressionstringctxTypeParameterExpressionretTypeTypefuncLibIReadOnlyDictionary<string, object>ctxConverterIReadOnlyDictionary<string, Type>
Returns
Remarks
In case any of the ctxType's properties should give an object of a dynamically created type
(like with CreateType(IList<DynamicProperty>, Type?, string?)):
The property exposed to the expression scope will now get the actual dynamic type given by the ctxConverter.
BuildLambdaExpression<TCtx, TRet>(string, IReadOnlyDictionary<string, object>, IReadOnlyDictionary<string, Type>)
code with access to the public properties of TCtx (and funcLib) returning TRet.
public static Expression<Func<TCtx, TRet>> BuildLambdaExpression<TCtx, TRet>(string code, IReadOnlyDictionary<string, object> funcLib, IReadOnlyDictionary<string, Type> ctxConverter)
Parameters
codestringfuncLibIReadOnlyDictionary<string, object>ctxConverterIReadOnlyDictionary<string, Type>
Returns
- Expression<Func<TCtx, TRet>>
Type Parameters
TCtxTRet
ParsedExpression(string, IEnumerable<ParameterExpression>, Type, IReadOnlyDictionary<string, object>)
Parse the expression with access to exprParams (and funcLib) returning retType
into a LambdaExpression.
public static LambdaExpression ParsedExpression(string expression, IEnumerable<ParameterExpression> exprParams, Type retType, IReadOnlyDictionary<string, object> funcLib)
Parameters
expressionstringexprParamsIEnumerable<ParameterExpression>retTypeTypefuncLibIReadOnlyDictionary<string, object>
Returns
ParsedExpression<TCtx>(string, Type, IReadOnlyDictionary<string, object>)
Parse the expression with access to the public properties of TCtx (and funcLib) returning retType
into a LambdaExpression.
public static LambdaExpression ParsedExpression<TCtx>(string expression, Type retType, IReadOnlyDictionary<string, object> funcLib)
Parameters
expressionstringretTypeTypefuncLibIReadOnlyDictionary<string, object>
Returns
Type Parameters
TCtx