Beispiel #1
0
        /// <summary>
        /// If debug logging is enabled, log a string such as "msg: expression.ToString()".
        /// </summary>
        internal static void LogExpression(string msg, Expression expression)
        {
            if (Log.IsDebugEnabled)
            {
                // If the expression contains NHibernate proxies, those will be initialized
                // when we call ToString() on the exception. The string representation is
                // generated by a class internal to System.Linq.Expression, so we cannot
                // actually override that logic. Circumvent it by replacing such ConstantExpressions
                // with ParameterExpression, having their name set to the string we wish to display.
                var visitor            = new ProxyReplacingExpressionTreeVisitor();
                var preparedExpression = visitor.VisitExpression(expression);

                Log.DebugFormat("{0}: {1}", msg, preparedExpression.ToString());
            }
        }
		/// <summary>
		/// If debug logging is enabled, log a string such as "msg: expression.ToString()".
		/// </summary>
		internal static void LogExpression(string msg, Expression expression)
		{
			if (Log.IsDebugEnabled)
			{
				// If the expression contains NHibernate proxies, those will be initialized
				// when we call ToString() on the exception. The string representation is
				// generated by a class internal to System.Linq.Expression, so we cannot
				// actually override that logic. Circumvent it by replacing such ConstantExpressions
				// with ParameterExpression, having their name set to the string we wish to display.
				var visitor = new ProxyReplacingExpressionTreeVisitor();
				var preparedExpression = visitor.VisitExpression(expression);

				Log.DebugFormat("{0}: {1}", msg, preparedExpression.ToString());
			}
		}