コード例 #1
0
        public static bool SqlAndParametersMatchFromSqlExpression(string sql, IEnumerable <object> parameters, FromSqlQueryRootExpression expression)
        {
            EnsureArgument.IsNotNull(expression, nameof(expression));
            EnsureArgument.IsNotNull(parameters, nameof(parameters));

            var result = SqlMatchesFromSqlExpression(sql, expression) &&
                         ParameterMatchingHelper.DoInvocationParametersMatchSetUpParameters(parameters, (object[])((ConstantExpression)expression.Argument).Value);

            Logger.LogDebug("Match? {result}", result);

            return(result);
        }
コード例 #2
0
        public static string StringifyFromSqlExpression(FromSqlQueryRootExpression expression)
        {
            EnsureArgument.IsNotNull(expression, nameof(expression));

            var expressionSql        = expression.Sql;
            var expressionParameters = (object[])((ConstantExpression)expression.Argument).Value;
            var parts = new List <string>();

            parts.Add($"Invocation sql: '{expressionSql}'");
            parts.Add("Invocation Parameters:");
            parts.Add(ParameterMatchingHelper.StringifyParameters(expressionParameters));
            return(string.Join(Environment.NewLine, parts));
        }