Class ConstantReplacerVisitor
This Expression Visitor will search for a specific constant value and then replace it with a supplied one
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: ImageVault.Client.Query.Parser
Assembly: ImageVault.Client.dll
Syntax
public class ConstantReplacerVisitor : ExpressionVisitor
Constructors
ConstantReplacerVisitor(Type)
Initializes a new instance of the ConstantReplacerVisitor class.
Declaration
public ConstantReplacerVisitor(Type type)
Parameters
Type | Name | Description |
---|---|---|
System.Type | type |
Methods
ReplaceConstant(Expression, Object)
Use this to replace the constant of the specified type
Declaration
public Expression ReplaceConstant(Expression expression, object item)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.Expressions.Expression | expression | The System.Linq.Expressions.Expression to use |
System.Object | item | The item to replace the constant with |
Returns
Type | Description |
---|---|
System.Linq.Expressions.Expression | The new System.Linq.Expressions.Expression with the replaced constant |
Exceptions
Type | Condition |
---|---|
InvalidQueryException | If constant was not replaced. |
VisitConstant(ConstantExpression)
Will inspect all constants and see if there is any matching constant that we will use to replace it with
Declaration
protected override Expression VisitConstant(ConstantExpression c)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.Expressions.ConstantExpression | c |
Returns
Type | Description |
---|---|
System.Linq.Expressions.Expression |
Overrides
Exceptions
Type | Condition |
---|---|
InvalidQueryException | If constant is present more than once. |