Ejemplo n.º 1
0
        /// <summary>
        /// Sets up the design time objects to represent the configuration for the validation block.
        /// </summary>
        /// <param name="serviceProvider">The a mechanism for retrieving a service object; that is, an object that provides custom support to other objects.</param>
        /// <param name="rootNode">The root node of the application.</param>
        /// <param name="section">The <see cref="ConfigurationSection"/> that was opened from the <see cref="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.IConfigurationSource"/>.</param>
        protected override void OpenCore(IServiceProvider serviceProvider,
                                         ConfigurationApplicationNode rootNode,
                                         ConfigurationSection section)
        {
            if (null != section)
            {
                ValidationSettingsNodeBuilder builder = new ValidationSettingsNodeBuilder(serviceProvider, (ValidationSettings)section);
                ValidationSettingsNode        node    = builder.Build();

                SetProtectionProvider(section, node);
                rootNode.AddNode(node);
            }
        }
Ejemplo n.º 2
0
        public ValidationSettingsNode Build()
        {
            this.node = new ValidationSettingsNode();

            foreach (ValidatedTypeReference typeReference in blockSettings.Types)
            {
                TypeNode typeNode = new TypeNode(typeReference);

                BuildTypeNode(typeNode, typeReference);


                this.node.AddNode(typeNode);
            }

            node.RequirePermission = blockSettings.SectionInformation.RequirePermission;

            return(node);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Gets the a <see cref="ConfigurationSectionInfo"/> for the security settings configuration section.
        /// </summary>
        /// <param name="serviceProvider">The a mechanism for retrieving a service object; that is, an object that provides custom support to other objects.</param>
        /// <returns>A <see cref="ConfigurationSectionInfo"/> for the validation settings configuration section.</returns>
        protected override Microsoft.Practices.EnterpriseLibrary.Configuration.Design.ConfigurationSectionInfo GetConfigurationSectionInfo(IServiceProvider serviceProvider)
        {
            ConfigurationNode      rootNode = ServiceHelper.GetCurrentRootNode(serviceProvider);
            ValidationSettingsNode node     = null;

            if (null != rootNode)
            {
                node = rootNode.Hierarchy.FindNodeByType(rootNode, typeof(ValidationSettingsNode)) as ValidationSettingsNode;
            }
            ValidationSettings blockSettings = null;

            if (node != null)
            {
                ValidationSettingsBuilder builder = new ValidationSettingsBuilder(serviceProvider, node);
                blockSettings = builder.Build();
            }

            string protectionProviderName = GetProtectionProviderName(node);

            return(new ConfigurationSectionInfo(node, blockSettings, ValidationSettings.SectionName, protectionProviderName));
        }
Ejemplo n.º 4
0
 public ValidationSettingsBuilder(IServiceProvider serviceProvider, ValidationSettingsNode blockSettingsNode)
 {
     this.blockSettingsNode = blockSettingsNode;
     hierarchy = ServiceHelper.GetCurrentHierarchy(serviceProvider);
 }
 public ValidationSettingsBuilder(IServiceProvider serviceProvider, ValidationSettingsNode blockSettingsNode)
 {
     this.blockSettingsNode = blockSettingsNode;
     hierarchy = ServiceHelper.GetCurrentHierarchy(serviceProvider);
 }