Пример #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         localChildren = _children;

            ProcessBodyChildren(request, ctx, parameterObject, localChildren);

            // Builds a 'dynamic' ParameterMap
            ParameterMap map = new ParameterMap(request.DataExchangeFactory);

            map.Id = _statement.Id + "-InlineParameterMap";
            map.Initialize(_usePositionalParameters, request);
            map.Class = _statement.ParameterClass;

            // Adds 'dynamic' ParameterProperty
            IList parameters = ctx.GetParameterMappings();
            int   count      = parameters.Count;

            for (int i = 0; i < count; i++)
            {
                map.AddParameterProperty((ParameterProperty)parameters[i]);
            }
            request.ParameterMap = map;

            string dynSql = ctx.BodyText;

            // Processes $substitutions$ after DynamicSql
            if (SimpleDynamicSql.IsSimpleDynamicSql(dynSql))
            {
                dynSql = new SimpleDynamicSql(request, dynSql, _statement).GetSql(parameterObject);
            }
            return(dynSql);
        }
Пример #2
0
        private string Process(RequestScope request, object parameterObject)
        {
            SqlTagContext ctx           = new SqlTagContext();
            IList         localChildren = this._children;

            this.ProcessBodyChildren(request, ctx, parameterObject, localChildren);
            ParameterMap map = new ParameterMap(request.DataExchangeFactory)
            {
                Id = this._statement.Id + "-InlineParameterMap"
            };

            map.Initialize(this._usePositionalParameters, request);
            map.Class = this._statement.ParameterClass;
            IList parameterMappings = ctx.GetParameterMappings();
            int   count             = parameterMappings.Count;

            for (int i = 0; i < count; i++)
            {
                map.AddParameterProperty((ParameterProperty)parameterMappings[i]);
            }
            request.ParameterMap = map;
            string bodyText = ctx.BodyText;

            if (SimpleDynamicSql.IsSimpleDynamicSql(bodyText))
            {
                bodyText = new SimpleDynamicSql(request, bodyText, this._statement).GetSql(parameterObject);
            }
            return(bodyText);
        }
Пример #3
0
        public static ParameterMap Deserialize(XmlNode node, ConfigurationScope configScope)
        {
            ParameterMap        map        = new ParameterMap(configScope.DataExchangeFactory);
            NameValueCollection attributes = NodeUtils.ParseAttributes(node, configScope.Properties);

            configScope.ErrorContext.MoreInfo = "ParameterMap DeSerializer";
            map.ExtendMap = NodeUtils.GetStringAttribute(attributes, "extends");
            map.Id        = NodeUtils.GetStringAttribute(attributes, "id");
            map.ClassName = NodeUtils.GetStringAttribute(attributes, "class");
            configScope.ErrorContext.MoreInfo = "Initialize ParameterMap";
            configScope.NodeContext           = node;
            map.Initialize(configScope.DataSource.DbProvider.UsePositionalParameters, configScope);
            map.BuildProperties(configScope);
            configScope.ErrorContext.MoreInfo = string.Empty;
            return(map);
        }