示例#1
0
        internal Application(ConfigurationElement element, ApplicationCollection parent)
            : base(element, "application", null, parent, null, null)
        {
            Parent = parent;

            // IMPORTANT: avoid duplicate application tag.
            ForceCreateEntity();
            if (string.IsNullOrWhiteSpace(Path))
            {
                // IMPORTANT: fix path attribute after initialization.
                Path = "/";
            }

            _collection = new VirtualDirectoryCollection(this);
            if (element == null)
            {
                return;
            }

            foreach (ConfigurationElement node in (ConfigurationElementCollection)element)
            {
                _collection.InternalAdd(new VirtualDirectory(node, _collection));
            }

            Location = this.Site.Name + this.Path;
            foreach (ApplicationPool pool in Server.ApplicationPools)
            {
                if (pool.Name == ApplicationPoolName)
                {
                    pool.ApplicationCount++;
                }
            }
        }
示例#2
0
        internal Application(ConfigurationElement element, ApplicationCollection parent)
            : base(element, "application", null, parent, null, null)
        {
            Parent = parent;
            if (Parent.Parent == null)
            {
                throw new ArgumentException("Site cannot be null", nameof(parent));
            }

            // IMPORTANT: avoid duplicate application tag.
            ForceCreateEntity();
            if (string.IsNullOrWhiteSpace(Path))
            {
                // IMPORTANT: fix path attribute after initialization.
                Path = "/";
            }

            VirtualDirectories = new VirtualDirectoryCollection(this);
            if (element == null)
            {
                return;
            }

            foreach (ConfigurationElement node in (ConfigurationElementCollection)element)
            {
                VirtualDirectories.InternalAdd(new VirtualDirectory(node, VirtualDirectories));
            }

            Location = Site.Name + Path;
            foreach (ApplicationPool pool in Server.ApplicationPools)
            {
                if (pool.Name == ApplicationPoolName)
                {
                    pool.ApplicationCount++;
                }
            }
        }
 internal VirtualDirectory(ConfigurationElement element, VirtualDirectoryCollection parent)
     : base(element, "virtualDirectory", null, parent, null, null)
 {
     Parent = parent;
 }