Documentation Coverage Report
Current view: top level - Cqrs.Sql/DataStores - SimpleExpressionReplacer.cs Hit Total Coverage
Version: 2.2 Artefacts: 3 3 100.0 %
Date: 2018-08-07 15:04:50

          Line data    Source code
       1             : #region Copyright
       2             : // // -----------------------------------------------------------------------
       3             : // // <copyright company="Chinchilla Software Limited">
       4             : // //   Copyright Chinchilla Software Limited. All rights reserved.
       5             : // // </copyright>
       6             : // // -----------------------------------------------------------------------
       7             : #endregion
       8             : 
       9             : using System.Linq.Expressions;
      10             : 
      11             : namespace Cqrs.Sql.DataStores
      12             : {
      13             :         /// <summary>
      14             :         /// Replaces or rewriter expression trees.
      15             :         /// </summary>
      16             :         public class SimpleExpressionReplacer : ExpressionVisitor
      17           1 :         {
      18             :                 private readonly Expression _replacement;
      19             : 
      20             :                 private readonly Expression _toFind;
      21             : 
      22             :                 /// <summary>
      23             :                 /// If the <see cref="Expression"/> to find (in the constructor) returns true, then the replacement <see cref="Expression"/> is returned.
      24             :                 /// </summary>
      25           1 :                 public override Expression Visit(Expression node)
      26             :                 {
      27             :                         return node == _toFind ? _replacement : base.Visit(node);
      28             :                 }
      29             : 
      30             :                 /// <summary>
      31             :                 /// Instantiates a new instance of the <see cref="SimpleExpressionReplacer"/> class
      32             :                 /// </summary>
      33           1 :                 public SimpleExpressionReplacer(Expression toFind, Expression replacement)
      34             :                 {
      35             :                         _toFind = toFind;
      36             :                         _replacement = replacement;
      37             :                 }
      38             :         }
      39             : }

Generated by: LCOV version 1.12