Class SubstituteTypeExpressionVisitor
The SubstituteTypeExpressionVisitor adjust types in the query substituting types with their substitute values and removes redundant Cast and OfType methods.
Inheritance
Inherited Members
Namespace: Kephas.Data.Linq.Expressions
Assembly: Kephas.Data.dll
Syntax
public class SubstituteTypeExpressionVisitor : ExpressionVisitor
Constructors
| Improve this Doc View SourceSubstituteTypeExpressionVisitor(Func<Type, IContext, Type>, IActivator, IEnumerable<ISubstituteTypeConstantHandler>, IContext)
Initializes a new instance of the SubstituteTypeExpressionVisitor class.
Declaration
public SubstituteTypeExpressionVisitor(Func<Type, IContext, Type> implementationTypeResolver = null, IActivator activator = null, IEnumerable<ISubstituteTypeConstantHandler> constantHandlers = null, IContext context = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Func<System.Type, IContext, System.Type> | implementationTypeResolver | The implementation type resolver (optional). |
| IActivator | activator | The activator (optional). |
| System.Collections.Generic.IEnumerable<ISubstituteTypeConstantHandler> | constantHandlers | The constant handlers (optional). |
| IContext | context | The context (optional). |
Methods
| Improve this Doc View SourceTryResolveDeepImplementationType(Type)
Tries to get the generic implementation type where the generic type arguments are replaced with implementation types.
Declaration
protected virtual Type TryResolveDeepImplementationType(Type constructedType)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Type | constructedType | Type of the constructed. |
Returns
| Type | Description |
|---|---|
| System.Type | A Type. |
TryResolveImplementationType(Type)
Tries to get the implementation type of the provided abstract type.
Declaration
protected virtual Type TryResolveImplementationType(Type abstractType)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Type | abstractType | The abstract type. |
Returns
| Type | Description |
|---|---|
| System.Type | The implementation type. |
Remarks
The provided abstract type may be a collection, in which case the item type is replaced with an implementation type.
Visit(Expression)
Dispatches the expression to one of the more specialized visit methods in this class.
Declaration
public override Expression Visit(Expression node)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Linq.Expressions.Expression | node | The expression to visit. |
Returns
| Type | Description |
|---|---|
| System.Linq.Expressions.Expression | The modified expression, if it or any subexpression was modified; otherwise, returns the original expression. |
Overrides
VisitConstant(ConstantExpression)
Visits the System.Linq.Expressions.ConstantExpression.
Declaration
protected override Expression VisitConstant(ConstantExpression node)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Linq.Expressions.ConstantExpression | node | The expression to visit. |
Returns
| Type | Description |
|---|---|
| System.Linq.Expressions.Expression | The modified expression, if it or any subexpression was modified; otherwise, returns the original expression. |
Overrides
VisitMember(MemberExpression)
Visits the children of the System.Linq.Expressions.MemberExpression.
Declaration
protected override Expression VisitMember(MemberExpression node)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Linq.Expressions.MemberExpression | node | The expression to visit. |
Returns
| Type | Description |
|---|---|
| System.Linq.Expressions.Expression | The modified expression, if it or any subexpression was modified; otherwise, returns the original expression. |
Overrides
VisitMethodCall(MethodCallExpression)
Visits the children of the System.Linq.Expressions.MethodCallExpression.
Declaration
protected override Expression VisitMethodCall(MethodCallExpression node)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Linq.Expressions.MethodCallExpression | node | The expression to visit. |
Returns
| Type | Description |
|---|---|
| System.Linq.Expressions.Expression | The modified expression, if it or any subexpression was modified; otherwise, returns the original expression. |
Overrides
VisitNew(NewExpression)
Visits the children of the System.Linq.Expressions.NewExpression.
Declaration
protected override Expression VisitNew(NewExpression node)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Linq.Expressions.NewExpression | node | The expression to visit. |
Returns
| Type | Description |
|---|---|
| System.Linq.Expressions.Expression | The modified expression, if it or any subexpression was modified; otherwise, returns the original expression. |
Overrides
VisitParameter(ParameterExpression)
Visits the System.Linq.Expressions.ParameterExpression.
Declaration
protected override Expression VisitParameter(ParameterExpression node)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Linq.Expressions.ParameterExpression | node | The expression to visit. |
Returns
| Type | Description |
|---|---|
| System.Linq.Expressions.Expression | The modified expression, if it or any subexpression was modified; otherwise, returns the original expression. |
Overrides
VisitUnary(UnaryExpression)
Visits the children of the System.Linq.Expressions.UnaryExpression.
Declaration
protected override Expression VisitUnary(UnaryExpression node)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Linq.Expressions.UnaryExpression | node | The expression to visit. |
Returns
| Type | Description |
|---|---|
| System.Linq.Expressions.Expression | The modified expression, if it or any subexpression was modified; otherwise, returns the original expression. |