예제 #1
0
        /// <summary>
        /// Mappings to the specified Argument.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <returns></returns>
        public ArgumentExpression MappingArgument(string name)
        {
            Contract.Require.That(name, Is.Not.Null & Is.Not.Empty).When("retrieving name argument in MappingArgument method");

            //if (parentConfiguration == null)
            //{
            //    argumentExpression = new ArgumentExpression(builder);
            //    parentConfiguration = builder.RegisterConfiguration();
            //    argumentExpression.parentConfiguration = parentConfiguration;
            //}
            //if (argumentExpression == null)
            //{
            //    argumentExpression = new ArgumentExpression(builder);
            //    argumentExpression.parentConfiguration = parentConfiguration;
            //}
            //currentArgument = new MutableConfiguration(ConfigConstants.ELEMENT_ARGUMENT, name);
            //currentArgument.CreateAttribute(ConfigConstants.ATTRIBUTE_ARGUMENTNAME, name);

            //parentConfiguration.Children.Add(currentSubMap);

            MutableConfiguration configArgument = new MutableConfiguration(ConfigConstants.ELEMENT_ARGUMENT, name);
            configArgument.CreateAttribute(ConfigConstants.ATTRIBUTE_ARGUMENTNAME, name);
            builder.CurrentConfiguration.Children.Add(configArgument);

            ArgumentExpression argumentExpression = new ArgumentExpression(builder, parentConfiguration, configArgument);

            return argumentExpression;
        }
예제 #2
0
        /// <summary>
        /// Processes the Sql element.
        /// </summary>
        /// <param name="element">The element.</param>
        /// <param name="configurationStore">The configuration store.</param>
        private void ProcessSqlElement(Tag element, IConfigurationStore configurationStore)
        {
            MutableConfiguration config = new MutableConfiguration(
                    element.Name,
                    element.Attributes[ConfigConstants.ATTRIBUTE_ID]);
            config.CreateAttribute(ConfigConstants.ATTRIBUTE_NAMESPACE, nameSpace);

            configurationStore.AddStatementConfiguration(config);
            element.Configuration = 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;
        }
예제 #4
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 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;
        }
예제 #6
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);
            }
        }
        /// <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;
        }