예제 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="request"></param>
        /// <param name="parameterObject"></param>
        /// <returns></returns>
        private string Process(RequestScope request, object parameterObject)
        {
            SqlTagContext     ctx           = new SqlTagContext();
            IList <ISqlChild> localChildren = children;

            ProcessBodyChildren(request, ctx, parameterObject, localChildren);

            // Builds a 'dynamic' ParameterMap
            ParameterMap parameterMap = new ParameterMap(
                statement.Id + "-InlineParameterMap",
                statement.ParameterClass.FullName,
                string.Empty,
                statement.ParameterClass,
                dataExchangeFactory.GetDataExchangeForClass(null),
                usePositionalParameters);

            // Adds 'dynamic' ParameterProperty
            var parameters = ctx.GetParameterMappings();

            parameterMap.AddParameterProperties(parameters);

            request.ParameterMap = parameterMap;

            string dynSql = ctx.BodyText;

            if (statement is Procedure)
            {
                dynSql = dynSql.Replace(MARK_TOKEN, string.Empty).Replace(COMMA_TOKEN, string.Empty).Trim();
            }

            // Processes $substitutions$ after DynamicSql
            if (SimpleDynamicSql.IsSimpleDynamicSql(dynSql))
            {
                dynSql = new SimpleDynamicSql(
                    dataExchangeFactory,
                    dbHelperParameterCache,
                    dynSql,
                    statement).GetSql(parameterObject);
            }
            return(dynSql);
        }