Ejemplo n.º 1
0
        /// <summary>
        /// Processes the database element in the SqlMap.config file.
        /// </summary>
        /// <param name="element">The element.</param>
        /// <param name="configurationStore">The configuration store.</param>
        private void ProcessDatabaseElement(Tag element, IConfigurationStore configurationStore)
        {
            MutableConfiguration config = new MutableConfiguration(element.Name);
            config.CreateAttributes(element.Attributes);

            configurationStore.AddDatabaseConfiguration(config);
            element.Configuration = config;
        }
        /// <summary>
        /// Processes the type handler element.
        /// </summary>
        /// <param name="element">The element.</param>
        /// <param name="configurationStore">The configuration store.</param>
        private void ProcessTypeHandlerElement(Tag element, IConfigurationStore configurationStore)
        {
            MutableConfiguration config = new MutableConfiguration(
                element.Name,
                element.Attributes[ConfigConstants.ATTRIBUTE_TYPE]
                );
            config.CreateAttributes(element.Attributes);

            configurationStore.AddTypeHandlerConfiguration(config);
        }
        /// <summary>
        /// Processes the flush intervall element.
        /// </summary>
        /// <param name="element">The element.</param>
        /// <param name="configurationStore">The configuration store.</param>
        private void ProcessFlushIntervallElement(Tag element, IConfigurationStore configurationStore)
        {
            if (element.Parent != null && element.Parent.Name == ConfigConstants.ELEMENT_CACHEMODEL)
            {
                MutableConfiguration config = new MutableConfiguration(element.Name);
                config.CreateAttributes(element.Attributes);

                element.Parent.Configuration.Children.Add(config);
            }
        }
        /// <summary>
        /// Processes a cache model element.
        /// </summary>
        /// <param name="element">The element.</param>
        /// <param name="configurationStore">The configuration store.</param>
        private void ProcessCacheModelElement(Tag element, IConfigurationStore configurationStore)
        {
            MutableConfiguration config = new MutableConfiguration(
                element.Name,
                ApplyNamespace(element.Attributes[ConfigConstants.ATTRIBUTE_ID]),
                element.Attributes[ConfigConstants.ATTRIBUTE_TYPE]);
            config.CreateAttributes(element.Attributes);
            config.CreateAttribute(ConfigConstants.ATTRIBUTE_NAMESPACE, nameSpace);

            configurationStore.AddCacheConfiguration(config);
            element.Configuration = config;
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Processes the dynamic elements.
        /// </summary>
        /// <param name="element">The element.</param>
        /// <param name="configurationStore">The configuration store.</param>
        private void ProcessDynamicElement(Tag element, IConfigurationStore configurationStore)
        {
            if (element.Parent != null)
            {
                MutableConfiguration config = new MutableConfiguration(element.Name);
                config.CreateAttributes(element.Attributes);
                config.Parent = element.Parent.Configuration;

                element.Parent.Configuration.Children.Add(config);
                element.Configuration = config;
            }
        }
        /// <summary>
        /// Processes the parameter element.
        /// </summary>
        /// <param name="element">The element.</param>
        /// <param name="configurationStore">The configuration store.</param>
        private void ProcessParameterElement(Tag element, IConfigurationStore configurationStore)
        {
            if (element.Parent != null && element.Parent.Name == ConfigConstants.ELEMENT_PARAMETERMAP)
            {
                MutableConfiguration config = new MutableConfiguration(
                    element.Name,
                    element.Attributes[ConfigConstants.ATTRIBUTE_PROPERTY]);
                config.CreateAttributes(element.Attributes);

                element.Parent.Configuration.Children.Add(config);
            }
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Processes the argument element.
        /// </summary>
        /// <param name="element">The element.</param>
        /// <param name="configurationStore">The configuration store.</param>
        private void ProcessArgumentElement(Tag element, IConfigurationStore configurationStore)
        {
            if (element.Parent != null && element.Parent.Name == ConfigConstants.ELEMENT_CONSTRUCTOR)
            {
                MutableConfiguration config = new MutableConfiguration(
                    element.Name,
                    element.Attributes[ConfigConstants.ATTRIBUTE_ARGUMENTNAME]);
                config.CreateAttributes(element.Attributes);

                element.Parent.Configuration.Children.Add(config);
            }
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Processes the Include element.
        /// </summary>
        /// <param name="element">The element.</param>
        /// <param name="configurationStore">The configuration store.</param>
        private void ProcessIncludeElement(Tag element, IConfigurationStore configurationStore)
        {
            MutableConfiguration config = new MutableConfiguration(
                element.Name,
                element.Attributes[ConfigConstants.ATTRIBUTE_REFID]);
            config.CreateAttribute(ConfigConstants.ATTRIBUTE_NAMESPACE, nameSpace);
            config.CreateAttributes(element.Attributes);
            config.Parent = element.Parent.Configuration;

            element.Parent.Configuration.Children.Add(config);
            element.Configuration = config;
        }
        /// <summary>
        /// Processes the flush on execute element.
        /// </summary>
        /// <param name="element">The element.</param>
        /// <param name="configurationStore">The configuration store.</param>
        private void ProcessFlushOnExecuteElement(Tag element, IConfigurationStore configurationStore)
        {
            if (element.Parent != null && element.Parent.Name == ConfigConstants.ELEMENT_CACHEMODEL)
            {
                MutableConfiguration config = new MutableConfiguration(
                    element.Name,
                    element.Attributes[ConfigConstants.ATTRIBUTE_STATEMENT]);
                config.CreateAttributes(element.Attributes);

                element.Parent.Configuration.Children.Add(config);
            }
        }
        /// <summary>
        /// Processes the discriminator element.
        /// </summary>
        /// <param name="element">The element.</param>
        /// <param name="configurationStore">The configuration store.</param>
        private void ProcessDiscriminatorElement(Tag element, IConfigurationStore configurationStore)
        {
            if (element.Parent != null && element.Parent.Name == ConfigConstants.ELEMENT_RESULTMAP)
            {
                MutableConfiguration config = new MutableConfiguration(
                    element.Name,
                    element.Attributes[ConfigConstants.ATTRIBUTE_COLUMN]);
                config.CreateAttributes(element.Attributes);
                element.Configuration = config;

                element.Parent.Configuration.Children.Add(config);
            }
        }
        /// <summary>
        /// Processes the DataSource element in the SqlMap.config file. 
        /// </summary>
        /// <param name="element">The element.</param>
        /// <param name="configurationStore">The configuration store.</param>
        private void ProcessDataSourceElement(Tag element, IConfigurationStore configurationStore)
        {
            if (element.Parent != null && element.Parent.Name == ConfigConstants.ELEMENT_DATABASE)
            {
                MutableConfiguration config = new MutableConfiguration(
                    element.Name,
                    element.Attributes[DataConstants.ATTRIBUTE_NAME],
                    element.Attributes[DataConstants.ATTRIBUTE_CONNECTIONSTRING]);
                config.CreateAttributes(element.Attributes);

                element.Parent.Configuration.Children.Add(config);
            }
        }
Ejemplo n.º 12
0
        /// <summary>
        /// Processes the discriminator/case element.
        /// </summary>
        /// <param name="element">The element.</param>
        /// <param name="configurationStore">The configuration store.</param>
        private void ProcessCaseElement(Tag element, IConfigurationStore configurationStore)
        {
            if (element.Parent != null && element.Parent.Name == ConfigConstants.ELEMENT_DISCRIMINATOR)
            {
                MutableConfiguration config = new MutableConfiguration(
                    element.Name,
                    element.Attributes[ConfigConstants.ATTRIBUTE_VALUE]);
                config.CreateAttributes(element.Attributes);

                AddAttribute(config, ConfigConstants.ATTRIBUTE_RESULTMAP, true);

                element.Parent.Configuration.Children.Add(config);
            }
        }
Ejemplo n.º 13
0
        /// <summary>
        /// Processes the result map element.
        /// </summary>
        /// <param name="element">The element.</param>
        /// <param name="configurationStore">The configuration store.</param>
        private void ProcessResultMapElement(Tag element, IConfigurationStore configurationStore)
        {
            MutableConfiguration config = new MutableConfiguration(
                    element.Name,
                    ApplyNamespace(element.Attributes[ConfigConstants.ATTRIBUTE_ID]),
                    element.Attributes[ConfigConstants.ATTRIBUTE_CLASS]);
            config.CreateAttributes(element.Attributes);
            config.CreateAttribute(ConfigConstants.ATTRIBUTE_NAMESPACE, nameSpace);

            AddAttribute(config, ConfigConstants.ATTRIBUTE_EXTENDS, true);

            configurationStore.AddResultMapConfiguration(config);
            element.Configuration = config;
        }
Ejemplo n.º 14
0
        /// <summary>
        /// Processes the discriminator/default element.
        /// </summary>
        /// <param name="element">The element.</param>
        /// <param name="configurationStore">The configuration store.</param>
        private void ProcessDefaultElement(Tag element, IConfigurationStore configurationStore)
        {
            if (element.Parent != null && element.Parent.Name == ConfigConstants.ELEMENT_DISCRIMINATOR)
            {
                MutableConfiguration config = new MutableConfiguration(
                    ConfigConstants.ELEMENT_CASE,
                    Discriminator.DEFAULT_KEY);
                config.CreateAttributes(element.Attributes);
                config.CreateAttribute(ConfigConstants.ATTRIBUTE_VALUE, Discriminator.DEFAULT_KEY);

                AddAttribute(config, ConfigConstants.ATTRIBUTE_RESULTMAP, true);

                element.Parent.Configuration.Children.Add(config);
            }
        }
Ejemplo n.º 15
0
        /// <summary>
        /// Processes the statement element.
        /// </summary>
        /// <param name="element">The element.</param>
        /// <param name="configurationStore">The configuration store.</param>
        private void ProcessStatementElement(Tag element, IConfigurationStore configurationStore)
        {
            MutableConfiguration config = new MutableConfiguration(
                    element.Name,
                    element.Attributes[ConfigConstants.ATTRIBUTE_ID]);
            config.CreateAttributes(element.Attributes);
            config.CreateAttribute(ConfigConstants.ATTRIBUTE_NAMESPACE, nameSpace);

            AddAttribute(config, ConfigConstants.ATTRIBUTE_CACHEMODEL, true);
            AddAttribute(config, ConfigConstants.ELEMENT_PARAMETERMAP, true);
            AddAttribute(config, ConfigConstants.ELEMENT_RESULTMAP, true);
            AddAttribute(config, ConfigConstants.ELEMENT_PRESERVEWHITESPACE, false);

            configurationStore.AddStatementConfiguration(config);
            element.Configuration = config;
        }
Ejemplo n.º 16
0
        /// <summary>
        /// Processes the provider element in the providers.config file.
        /// </summary>
        /// <param name="element">The element.</param>
        /// <param name="configurationStore">The configuration store.</param>
        private void ProcessProviderElement(Tag element, IConfigurationStore configurationStore)
        {
            // provider child tag of Database tag
            if (element.Parent != null && element.Parent.Name == "database")
            {
                MutableConfiguration config = new MutableConfiguration(
                    element.Name,
                    element.Attributes[DataConstants.ATTRIBUTE_NAME],
                    element.Attributes[DataConstants.ATTRIBUTE_NAME]);
                config.CreateAttributes(element.Attributes);
                element.Parent.Configuration.Children.Add(config);
            }
            else
            {
                MutableConfiguration config = new MutableConfiguration(
                    element.Name,
                    element.Attributes[DataConstants.ATTRIBUTE_NAME]);
                config.CreateAttributes(element.Attributes);

                configurationStore.AddProviderConfiguration(config);
            }
        }