public static Expression Transform (Expression expression, IExpressionTranformationProvider tranformationProvider)
 {
   ArgumentUtility.CheckNotNull ("tranformationProvider", tranformationProvider);
   
   var visitor = new TransformingExpressionTreeVisitor (tranformationProvider);
   return visitor.VisitExpression (expression);
 }
Ejemplo n.º 2
0
    /// <summary>
    /// Creates a default <see cref="CompoundExpressionTreeProcessor"/> that already has the expression tree processing steps defined by the re-linq assembly
    /// registered. Users can insert additional processing steps.
    /// </summary>
    /// <param name="tranformationProvider">The tranformation provider to be used by the <see cref="TransformingExpressionTreeProcessor"/> included
    /// in the result set. Use <see cref="ExpressionTransformerRegistry.CreateDefault"/> to create a default provider.</param>
    /// <returns>
    /// A default <see cref="CompoundExpressionTreeProcessor"/> that already has all expression tree processing steps defined by the re-linq assembly
    /// registered.
    /// </returns>
    /// <remarks>
    /// The following steps are included:
    /// <list type="bullet">
    /// 		<item><see cref="PartialEvaluatingExpressionTreeProcessor"/></item>
    /// 		<item><see cref="TransformingExpressionTreeProcessor"/> (parameterized with <paramref name="tranformationProvider"/>)</item>
    /// 	</list>
    /// </remarks>
    public static CompoundExpressionTreeProcessor CreateDefaultProcessor (IExpressionTranformationProvider tranformationProvider)
    {
      ArgumentUtility.CheckNotNull ("tranformationProvider", tranformationProvider);

      return new CompoundExpressionTreeProcessor (new IExpressionTreeProcessor[] { 
          new PartialEvaluatingExpressionTreeProcessor(), 
          new TransformingExpressionTreeProcessor (tranformationProvider) });
    }
 public static CompoundExpressionTreeProcessor CreateDefaultProcessor(
     IExpressionTranformationProvider tranformationProvider)
 {
     Mandate.ParameterNotNull(tranformationProvider, "tranformationProvider");
     return new CompoundExpressionTreeProcessor(
         new IExpressionTreeProcessor[]
             {
                 new ModifiedPartialEvaluatingExpressionTreeProcessor(),
                 new TransformingExpressionTreeProcessor(tranformationProvider)
             });
 }
    protected TransformingExpressionTreeVisitor (IExpressionTranformationProvider tranformationProvider)
    {
      ArgumentUtility.CheckNotNull ("tranformationProvider", tranformationProvider);

      _tranformationProvider = tranformationProvider;
    }
    /// <summary>
    /// Initializes a new instance of the <see cref="TransformingExpressionTreeProcessor"/> class.
    /// </summary>
    /// <param name="provider">A class providing the transformations to apply to the tree, eg., an instance of 
    /// <see cref="ExpressionTransformerRegistry"/>.</param>
    public TransformingExpressionTreeProcessor (IExpressionTranformationProvider provider)
    {
      ArgumentUtility.CheckNotNull ("provider", provider);

      _provider = provider;
    }
Ejemplo n.º 6
0
        private TransformingExpressionVisitor(IExpressionTranformationProvider tranformationProvider)
        {
            ArgumentUtility.CheckNotNull("tranformationProvider", tranformationProvider);

            _tranformationProvider = tranformationProvider;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="TransformingExpressionTreeProcessor"/> class.
        /// </summary>
        /// <param name="provider">A class providing the transformations to apply to the tree, eg., an instance of
        /// <see cref="ExpressionTransformerRegistry"/>.</param>
        public TransformingExpressionTreeProcessor(IExpressionTranformationProvider provider)
        {
            ArgumentUtility.CheckNotNull("provider", provider);

            _provider = provider;
        }
 protected TransformingExpressionTreeVisitor(IExpressionTranformationProvider tranformationProvider)
 {
     _tranformationProvider = tranformationProvider;
 }
        public static Expression Transform(Expression expression, IExpressionTranformationProvider tranformationProvider)
        {
            var visitor = new TransformingExpressionTreeVisitor(tranformationProvider);

            return(visitor.VisitExpression(expression));
        }
Ejemplo n.º 10
0
 /// <summary>
 /// The create default processor.
 /// </summary>
 /// <param name="provider">
 /// The provider.
 /// </param>
 /// <returns>
 /// The <see cref="CompoundExpressionTreeProcessor"/>.
 /// </returns>
 public static CompoundExpressionTreeProcessor CreateDefaultProcessor(IExpressionTranformationProvider provider)
 {
     return
         (new CompoundExpressionTreeProcessor(
              new IExpressionTreeProcessor[] { new TransformingExpressionTreeProcessor(provider) }));
 }