RootProfilePropertySettingsCollection Класс

Определение

Функционирует в качестве верхнего уровня двухуровневой именованной иерархии коллекций ProfilePropertySettingsCollection.

public ref class RootProfilePropertySettingsCollection sealed : System::Web::Configuration::ProfilePropertySettingsCollection
[System.Configuration.ConfigurationCollection(typeof(System.Web.Configuration.ProfilePropertySettings))]
public sealed class RootProfilePropertySettingsCollection : System.Web.Configuration.ProfilePropertySettingsCollection
[<System.Configuration.ConfigurationCollection(typeof(System.Web.Configuration.ProfilePropertySettings))>]
type RootProfilePropertySettingsCollection = class
    inherit ProfilePropertySettingsCollection
Public NotInheritable Class RootProfilePropertySettingsCollection
Inherits ProfilePropertySettingsCollection
Наследование
Атрибуты

Примеры

В следующем примере кода показано, как использовать RootProfilePropertySettingsCollection тип в PropertySettings качестве свойства ProfileSection класса . Этот пример входит в состав более крупного примера использования класса ProfileSection.


// Display all current root ProfilePropertySettings.
Console.WriteLine("Current Root ProfilePropertySettings:");
int rootPPSCtr = 0;
foreach (ProfilePropertySettings rootPPS in profileSection.PropertySettings)
{
    Console.WriteLine("  {0}: ProfilePropertySetting '{1}'", ++rootPPSCtr,
        rootPPS.Name);
}

// Get and modify a root ProfilePropertySettings object.
Console.WriteLine(
    "Display and modify 'LastReadDate' ProfilePropertySettings:");
ProfilePropertySettings profilePropertySettings =
    profileSection.PropertySettings["LastReadDate"];

// Get the current ReadOnly property value.
Console.WriteLine(
    "Current ReadOnly value: '{0}'", profilePropertySettings.ReadOnly);

// Set the ReadOnly property to true.
profilePropertySettings.ReadOnly = true;

// Get the current AllowAnonymous property value.
Console.WriteLine(
    "Current AllowAnonymous value: '{0}'", profilePropertySettings.AllowAnonymous);

// Set the AllowAnonymous property to true.
profilePropertySettings.AllowAnonymous = true;

// Get the current SerializeAs property value.
Console.WriteLine(
    "Current SerializeAs value: '{0}'", profilePropertySettings.SerializeAs);

// Set the SerializeAs property to SerializationMode.Binary.
profilePropertySettings.SerializeAs = SerializationMode.Binary;

// Get the current Type property value.
Console.WriteLine(
    "Current Type value: '{0}'", profilePropertySettings.Type);

// Set the Type property to "System.DateTime".
profilePropertySettings.Type = "System.DateTime";

// Get the current DefaultValue property value.
Console.WriteLine(
    "Current DefaultValue value: '{0}'", profilePropertySettings.DefaultValue);

// Set the DefaultValue property to "March 16, 2004".
profilePropertySettings.DefaultValue = "March 16, 2004";

// Get the current ProviderName property value.
Console.WriteLine(
    "Current ProviderName value: '{0}'", profilePropertySettings.Provider);

// Set the ProviderName property to "AspNetSqlRoleProvider".
profilePropertySettings.Provider = "AspNetSqlRoleProvider";

// Get the current Name property value.
Console.WriteLine(
    "Current Name value: '{0}'", profilePropertySettings.Name);

// Set the Name property to "LastAccessDate".
profilePropertySettings.Name = "LastAccessDate";

// Display all current ProfileGroupSettings.
Console.WriteLine("Current ProfileGroupSettings:");
int PGSCtr = 0;
foreach (ProfileGroupSettings propGroups in profileSection.PropertySettings.GroupSettings)
{
    Console.WriteLine("  {0}: ProfileGroupSetting '{1}'", ++PGSCtr,
        propGroups.Name);
    int PPSCtr = 0;
    foreach (ProfilePropertySettings props in propGroups.PropertySettings)
    {
        Console.WriteLine("    {0}: ProfilePropertySetting '{1}'", ++PPSCtr,
            props.Name);
    }
}

// Add a new group.
ProfileGroupSettings newPropGroup = new ProfileGroupSettings("Forum");
profileSection.PropertySettings.GroupSettings.Add(newPropGroup);

// Add a new PropertySettings to the group.
ProfilePropertySettings newProp = new ProfilePropertySettings("AvatarImage");
newProp.Type = "System.String, System.dll";
newPropGroup.PropertySettings.Add(newProp);

// Remove a PropertySettings from the group.
newPropGroup.PropertySettings.Remove("AvatarImage");
newPropGroup.PropertySettings.RemoveAt(0);

// Clear all PropertySettings from the group.
newPropGroup.PropertySettings.Clear();


' Display all current root ProfilePropertySettings.
Console.WriteLine("Current Root ProfilePropertySettings:")
Dim rootPPSCtr As Integer = 0
For Each rootPPS As ProfilePropertySettings In profileSection.PropertySettings
    Console.WriteLine("  {0}: ProfilePropertySetting '{1}'", ++rootPPSCtr, _
        rootPPS.Name)
Next

' Get and modify a root ProfilePropertySettings object.
Console.WriteLine( _
    "Display and modify 'LastReadDate' ProfilePropertySettings:")
Dim profilePropertySettings As ProfilePropertySettings = _
    profileSection.PropertySettings("LastReadDate")

' Get the current ReadOnly property value.
Console.WriteLine( _
    "Current ReadOnly value: '{0}'", profilePropertySettings.ReadOnly)

' Set the ReadOnly property to true.
profilePropertySettings.ReadOnly = true

' Get the current AllowAnonymous property value.
Console.WriteLine( _
    "Current AllowAnonymous value: '{0}'", profilePropertySettings.AllowAnonymous)

' Set the AllowAnonymous property to true.
profilePropertySettings.AllowAnonymous = true

' Get the current SerializeAs property value.
Console.WriteLine( _
    "Current SerializeAs value: '{0}'", profilePropertySettings.SerializeAs)

' Set the SerializeAs property to SerializationMode.Binary.
profilePropertySettings.SerializeAs = SerializationMode.Binary

' Get the current Type property value.
Console.WriteLine( _
    "Current Type value: '{0}'", profilePropertySettings.Type)

' Set the Type property to "System.DateTime".
profilePropertySettings.Type = "System.DateTime"

' Get the current DefaultValue property value.
Console.WriteLine( _
    "Current DefaultValue value: '{0}'", profilePropertySettings.DefaultValue)

' Set the DefaultValue property to "March 16, 2004".
profilePropertySettings.DefaultValue = "March 16, 2004"

' Get the current ProviderName property value.
            Console.WriteLine( _
                "Current ProviderName value: '{0}'", profilePropertySettings.Provider)

' Set the ProviderName property to "AspNetSqlRoleProvider".
            profilePropertySettings.Provider = "AspNetSqlRoleProvider"

' Get the current Name property value.
Console.WriteLine( _
    "Current Name value: '{0}'", profilePropertySettings.Name)

' Set the Name property to "LastAccessDate".
profilePropertySettings.Name = "LastAccessDate"

' Display all current ProfileGroupSettings.
Console.WriteLine("Current ProfileGroupSettings:")
Dim PGSCtr As Integer = 0
For Each propGroups As ProfileGroupSettings In profileSection.PropertySettings.GroupSettings
                    Console.WriteLine("  {0}: ProfileGroupSettings '{1}'", ++PGSCtr, _
        propGroups.Name)
    Dim PPSCtr As Integer = 0
    For Each props As ProfilePropertySettings In propGroups.PropertySettings
        Console.WriteLine("    {0}: ProfilePropertySetting '{1}'", ++PPSCtr, _
            props.Name)
    Next
Next

' Add a new group.
Dim newPropGroup As ProfileGroupSettings = new ProfileGroupSettings("Forum")
profileSection.PropertySettings.GroupSettings.Add(newPropGroup)

' Add a new PropertySettings to the group.
Dim newProp As ProfilePropertySettings = new ProfilePropertySettings("AvatarImage")
newProp.Type = "System.String, System.dll"
newPropGroup.PropertySettings.Add(newProp)

' Remove a PropertySettings from the group.
newPropGroup.PropertySettings.Remove("AvatarImage")
newPropGroup.PropertySettings.RemoveAt(0)

' Clear all PropertySettings from the group.
newPropGroup.PropertySettings.Clear()

Комментарии

Класс RootProfilePropertySettingsCollection является коллекцией корневого уровня ProfilePropertySettingsCollection и контейнером ProfileGroupSettingsCollection для коллекции. Эти коллекции позволяют создавать именованные группы дополнительных ProfilePropertySettingsCollection коллекций, каждая из которых содержит отдельные именованные ProfilePropertySettings объекты. Дополнительные сведения о функциях профиля, добавленных в ASP.NET 2.0, см. в разделе Свойства профиля ASP.NET.

Свойство PropertySettings — это RootProfilePropertySettingsCollection объект, содержащий все свойства, определенные в properties подразделе profile раздела файла конфигурации.

Конструкторы

RootProfilePropertySettingsCollection()

Инициализирует новый экземпляр класса RootProfilePropertySettingsCollection значениями по умолчанию.

Свойства

AddElementName

Возвращает или устанавливает имя ConfigurationElement, связанное с операцией добавления в ConfigurationElementCollection после переопределения в производном классе.

(Унаследовано от ConfigurationElementCollection)
AllKeys

Возврат массива, содержащего имена всех объектов ProfileSection, включенных в коллекцию.

(Унаследовано от ProfilePropertySettingsCollection)
AllowClear

Возвращает значение, указывающее, допустим ли элемент <clear> как объект ProfilePropertySettings.

(Унаследовано от ProfilePropertySettingsCollection)
ClearElementName

Возвращает или задает имя ConfigurationElement, связанное с операцией очистки в ConfigurationElementCollection после переопределения в производном классе.

(Унаследовано от ConfigurationElementCollection)
CollectionType

Возвращает тип службы ConfigurationElementCollection.

(Унаследовано от ConfigurationElementCollection)
Count

Получает количество элементов коллекции.

(Унаследовано от ConfigurationElementCollection)
CurrentConfiguration

Возвращает ссылку на экземпляр Configuration верхнего уровня, представляющий иерархию конфигурации, к которой относится текущий экземпляр ConfigurationElement.

(Унаследовано от ConfigurationElement)
ElementInformation

Возвращает объект ElementInformation, содержащий неизменяемую информацию и функциональность объекта ConfigurationElement.

(Унаследовано от ConfigurationElement)
ElementName

Получает имя, используемое для данной коллекции элементов в файле конфигурации после переопределения в производном классе.

(Унаследовано от ConfigurationElementCollection)
ElementProperty

Возвращает объект ConfigurationElementProperty, представляющий сам объект ConfigurationElement.

(Унаследовано от ConfigurationElement)
EmitClear

Получает или задает значение, указывающее, была ли коллекция очищена.

(Унаследовано от ConfigurationElementCollection)
EvaluationContext

Возвращает объект ContextInformation для объекта ConfigurationElement.

(Унаследовано от ConfigurationElement)
GroupSettings

Получает ProfileGroupSettingsCollection, содержащий коллекцию объектов ProfileGroupSettings.

HasContext

Возвращает значение, указывающее, имеет ли свойство CurrentConfiguration значение null.

(Унаследовано от ConfigurationElement)
IsSynchronized

Возвращает значение, показывающее, синхронизирован ли доступ к коллекции.

(Унаследовано от ConfigurationElementCollection)
Item[ConfigurationProperty]

Возвращает или задает свойство или атрибут данного элемента конфигурации.

(Унаследовано от ConfigurationElement)
Item[Int32]

Получает или задает объект ProfilePropertySettings по указанному индексу.

(Унаследовано от ProfilePropertySettingsCollection)
Item[String]

Получает или задает объект ProfilePropertySettings с заданным именем.

(Унаследовано от ProfilePropertySettingsCollection)
LockAllAttributesExcept

Возвращает коллекцию заблокированных атрибутов.

(Унаследовано от ConfigurationElement)
LockAllElementsExcept

Возвращает коллекцию заблокированных элементов.

(Унаследовано от ConfigurationElement)
LockAttributes

Возвращает коллекцию заблокированных атрибутов.

(Унаследовано от ConfigurationElement)
LockElements

Возвращает коллекцию заблокированных элементов.

(Унаследовано от ConfigurationElement)
LockItem

Возвращает или задает значение, указывающее, заблокирован ли элемент.

(Унаследовано от ConfigurationElement)
Properties

Возвращает коллекцию свойств конфигурации.

(Унаследовано от ProfilePropertySettingsCollection)
RemoveElementName

Получает или задает имя ConfigurationElement, связанное с операцией удаления в ConfigurationElementCollection после переопределения в производном классе.

(Унаследовано от ConfigurationElementCollection)
SyncRoot

Получает объект, используемый для синхронизации доступа к ConfigurationElementCollection.

(Унаследовано от ConfigurationElementCollection)
ThrowOnDuplicate

Возврат значения, определяющего необходимость создания ошибки при попытке создания дублирующего объекта.

(Унаследовано от ProfilePropertySettingsCollection)

Методы

Add(ProfilePropertySettings)

Добавляет объект ProfilePropertySettings в коллекцию.

(Унаследовано от ProfilePropertySettingsCollection)
BaseAdd(ConfigurationElement)

Добавляет новый элемент конфигурации в ConfigurationElementCollection.

(Унаследовано от ConfigurationElementCollection)
BaseAdd(ConfigurationElement, Boolean)

Добавляет элемент конфигурации в коллекцию элементов конфигурации.

(Унаследовано от ConfigurationElementCollection)
BaseAdd(Int32, ConfigurationElement)

Добавляет элемент конфигурации в коллекцию элементов конфигурации.

(Унаследовано от ConfigurationElementCollection)
BaseClear()

Удаляет все объекты элементов конфигурации из коллекции.

(Унаследовано от ConfigurationElementCollection)
BaseGet(Int32)

Возвращает элемент конфигурации с указанным расположением индекса.

(Унаследовано от ConfigurationElementCollection)
BaseGet(Object)

Возвращает элемент конфигурации с указанным ключом.

(Унаследовано от ConfigurationElementCollection)
BaseGetAllKeys()

Возвращает массив ключей для всех элементов конфигурации, содержащихся в ConfigurationElementCollection.

(Унаследовано от ConfigurationElementCollection)
BaseGetKey(Int32)

Получает ключ объекта ConfigurationElement по указанному расположению индекса.

(Унаследовано от ConfigurationElementCollection)
BaseIndexOf(ConfigurationElement)

Указывает индекс заданного объекта ConfigurationElement.

(Унаследовано от ConfigurationElementCollection)
BaseIsRemoved(Object)

Указывает, удален ли ConfigurationElement с указанным ключом из ConfigurationElementCollection.

(Унаследовано от ConfigurationElementCollection)
BaseRemove(Object)

Удаляет объект ConfigurationElement из коллекции.

(Унаследовано от ConfigurationElementCollection)
BaseRemoveAt(Int32)

Удаляет объект ConfigurationElement по указанному расположению индекса.

(Унаследовано от ConfigurationElementCollection)
Clear()

Удаляет все объекты ProfilePropertySettings из коллекции.

(Унаследовано от ProfilePropertySettingsCollection)
CopyTo(ConfigurationElement[], Int32)

Копирует содержимое объекта ConfigurationElementCollection в массив.

(Унаследовано от ConfigurationElementCollection)
CreateNewElement()

При переопределении в производном классе создает новый объект ConfigurationElement.

(Унаследовано от ProfilePropertySettingsCollection)
CreateNewElement(String)

При переопределении в производном классе создает новый элемент ConfigurationElement.

(Унаследовано от ConfigurationElementCollection)
DeserializeElement(XmlReader, Boolean)

Считывает XML из файла конфигурации.

(Унаследовано от ConfigurationElement)
Equals(Object)

Сравнивает текущий объект RootProfilePropertySettingsCollection с другим объектом A RootProfilePropertySettingsCollection.

Get(Int32)

Возвращает объект ProfileSection, расположенный по заданному индексу.

(Унаследовано от ProfilePropertySettingsCollection)
Get(String)

Возвращает объект ProfileSection с указанным именем.

(Унаследовано от ProfilePropertySettingsCollection)
GetElementKey(ConfigurationElement)

Возврат ключа для заданного элемента конфигурации.

(Унаследовано от ProfilePropertySettingsCollection)
GetEnumerator()

Получает метод IEnumerator, используемый для итерации по ConfigurationElementCollection.

(Унаследовано от ConfigurationElementCollection)
GetHashCode()

Создает хэш-код для коллекции.

GetKey(Int32)

Возврат имени объекта ProfilePropertySettings, расположенного в позиции с заданным индексом.

(Унаследовано от ProfilePropertySettingsCollection)
GetTransformedAssemblyString(String)

Возвращает преобразованную версию указанного имени сборки.

(Унаследовано от ConfigurationElement)
GetTransformedTypeString(String)

Возвращает преобразованную версию указанного имени типа.

(Унаследовано от ConfigurationElement)
GetType()

Возвращает объект Type для текущего экземпляра.

(Унаследовано от Object)
IndexOf(ProfilePropertySettings)

Возвращает индекс указанного объекта ProfilePropertySettings.

(Унаследовано от ProfilePropertySettingsCollection)
Init()

Задает объект ConfigurationElement в исходное состояние.

(Унаследовано от ConfigurationElement)
InitializeDefault()

Используется для инициализации набора значений по умолчанию для объекта ConfigurationElement.

(Унаследовано от ConfigurationElement)
IsElementName(String)

Указывает, существует ли указанный ConfigurationElement в ConfigurationElementCollection.

(Унаследовано от ConfigurationElementCollection)
IsElementRemovable(ConfigurationElement)

Указывает, может ли указанный объект ConfigurationElement быть удален из ConfigurationElementCollection.

(Унаследовано от ConfigurationElementCollection)
IsModified()

Указывает, был ли изменен ConfigurationElementCollection с момента последнего сохранения или загрузки после переопределения в производном классе.

(Унаследовано от ConfigurationElementCollection)
IsReadOnly()

Указывает, доступен ли объект ConfigurationElementCollection только для чтения.

(Унаследовано от ConfigurationElementCollection)
ListErrors(IList)

Добавляет ошибку "недействительное свойство" в данном объекте ConfigurationElement и всех его дочерних элементах к переданному списку.

(Унаследовано от ConfigurationElement)
MemberwiseClone()

Создает неполную копию текущего объекта Object.

(Унаследовано от Object)
OnDeserializeUnrecognizedAttribute(String, String)

Возвращает значение, указывающее, встретился ли неизвестный атрибут при десериализации.

(Унаследовано от ConfigurationElement)
OnDeserializeUnrecognizedElement(String, XmlReader)

Чтение нераспознанных элементов конфигурации из файла конфигурации и создание исключения системы конфигурации, если обработка элемента невозможна.

(Унаследовано от ProfilePropertySettingsCollection)
OnRequiredPropertyNotFound(String)

Выдает исключение, если требуемое свойство не найдено.

(Унаследовано от ConfigurationElement)
PostDeserialize()

Вызывается после десериализации.

(Унаследовано от ConfigurationElement)
PreSerialize(XmlWriter)

Вызывается до сериализации.

(Унаследовано от ConfigurationElement)
Remove(String)

Удаляет объект ProfilePropertySettings из коллекции.

(Унаследовано от ProfilePropertySettingsCollection)
RemoveAt(Int32)

Удаление объекта ProfilePropertySettings из коллекции в заданном месте индекса.

(Унаследовано от ProfilePropertySettingsCollection)
Reset(ConfigurationElement)

Сбрасывает ConfigurationElementCollection в неизмененное состояние после переопределения в производном классе.

(Унаследовано от ConfigurationElementCollection)
ResetModified()

Переустанавливает значение свойства IsModified() в false при переопределении в производном классе.

(Унаследовано от ConfigurationElementCollection)
SerializeElement(XmlWriter, Boolean)

Записывает данные конфигурации в XML-элемент в файле конфигурации после переопределения в производном классе.

(Унаследовано от ConfigurationElementCollection)
SerializeToXmlElement(XmlWriter, String)

Записывает внешние теги данного элемента конфигурации в файл конфигурации при реализации в производном классе.

(Унаследовано от ConfigurationElement)
Set(ProfilePropertySettings)

Добавляет указанный объект ProfilePropertySettings в коллекцию.

(Унаследовано от ProfilePropertySettingsCollection)
SetPropertyValue(ConfigurationProperty, Object, Boolean)

Задает для свойства указанное значение.

(Унаследовано от ConfigurationElement)
SetReadOnly()

Устанавливает свойство IsReadOnly() для объекта ConfigurationElementCollection и всех подчиненных элементов.

(Унаследовано от ConfigurationElementCollection)
ToString()

Возвращает строку, представляющую текущий объект.

(Унаследовано от Object)
Unmerge(ConfigurationElement, ConfigurationElement, ConfigurationSaveMode)

Отменяет эффект слияния данных конфигурации на разных уровнях иерархии конфигурации.

(Унаследовано от ConfigurationElementCollection)

Явные реализации интерфейса

ICollection.CopyTo(Array, Int32)

Копирует ConfigurationElementCollection в массив.

(Унаследовано от ConfigurationElementCollection)

Методы расширения

Cast<TResult>(IEnumerable)

Приводит элементы объекта IEnumerable к заданному типу.

OfType<TResult>(IEnumerable)

Выполняет фильтрацию элементов объекта IEnumerable по заданному типу.

AsParallel(IEnumerable)

Позволяет осуществлять параллельный запрос.

AsQueryable(IEnumerable)

Преобразовывает коллекцию IEnumerable в объект IQueryable.

Применяется к

См. также раздел