Compartilhar via


RootProfilePropertySettingsCollection Classe

Definição

Funciona como a parte superior de uma hierarquia nomeada de dois níveis de coleções 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
Herança
Atributos

Exemplos

O exemplo de código a seguir mostra como usar o RootProfilePropertySettingsCollection tipo como a PropertySettings propriedade da ProfileSection classe. Este exemplo de código faz parte de um exemplo maior fornecido para a ProfileSection classe.


// 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()

Comentários

A RootProfilePropertySettingsCollection classe é uma coleção de nível ProfilePropertySettingsCollection raiz e um contêiner para uma ProfileGroupSettingsCollection coleção. Essas coleções permitem que você crie grupos nomeados de mais ProfilePropertySettingsCollection coleções, cada uma contendo objetos nomeados ProfilePropertySettings individuais. Para obter mais informações sobre os recursos de perfil adicionados ao ASP.NET 2.0, consulte ASP.NET Propriedades do Perfil.

A PropertySettings propriedade é um RootProfilePropertySettingsCollection objeto que contém todas as propriedades definidas na properties subseção da profile seção do arquivo de configuração.

Construtores

RootProfilePropertySettingsCollection()

Inicializa uma nova instância da classe RootProfilePropertySettingsCollection usando as configurações padrão.

Propriedades

AddElementName

Obtém ou define o nome do ConfigurationElement a ser associado à operação de adição no ConfigurationElementCollection quando substituído em uma classe derivada.

(Herdado de ConfigurationElementCollection)
AllKeys

Retorna uma matriz que contém os nomes de todos os objetos ProfileSection contidos na coleção.

(Herdado de ProfilePropertySettingsCollection)
AllowClear

Obtém um valor que indica se o elemento <limpar> é válido como um objeto ProfilePropertySettings.

(Herdado de ProfilePropertySettingsCollection)
ClearElementName

Obtém ou define o nome do ConfigurationElement a ser associado à operação de limpeza no ConfigurationElementCollection quando substituído em uma classe derivada.

(Herdado de ConfigurationElementCollection)
CollectionType

Obtém o tipo do ConfigurationElementCollection.

(Herdado de ConfigurationElementCollection)
Count

Obtém o número de elementos na coleção.

(Herdado de ConfigurationElementCollection)
CurrentConfiguration

Obtém uma referência para a instância Configuration de nível superior que representa a hierarquia de configuração à qual a instância atual ConfigurationElement pertence.

(Herdado de ConfigurationElement)
ElementInformation

Obtém um objeto ElementInformation que contém as informações não personalizáveis e a funcionalidade do objeto ConfigurationElement.

(Herdado de ConfigurationElement)
ElementName

Obtém o nome usado para identificar esta coleção de elementos no arquivo de configuração quando substituído em uma classe derivada.

(Herdado de ConfigurationElementCollection)
ElementProperty

Obtém o objeto ConfigurationElementProperty que representa o próprio objeto ConfigurationElement.

(Herdado de ConfigurationElement)
EmitClear

Obtém ou define um valor que especifica se a coleção foi limpa.

(Herdado de ConfigurationElementCollection)
EvaluationContext

Obtém o objeto ContextInformation para o objeto ConfigurationElement.

(Herdado de ConfigurationElement)
GroupSettings

Obtém um ProfileGroupSettingsCollection que contém uma coleção de objetos ProfileGroupSettings.

HasContext

Obtém um valor que indica se a propriedade CurrentConfiguration é null.

(Herdado de ConfigurationElement)
IsSynchronized

Obtém um valor que indica se o acesso à coleção é sincronizado.

(Herdado de ConfigurationElementCollection)
Item[ConfigurationProperty]

Obtém ou define uma propriedade ou um atributo desse elemento de configuração.

(Herdado de ConfigurationElement)
Item[Int32]

Obtém ou define o objeto ProfilePropertySettings no local do índice especificado.

(Herdado de ProfilePropertySettingsCollection)
Item[String]

Obtém ou define o objeto ProfilePropertySettings com o nome especificado.

(Herdado de ProfilePropertySettingsCollection)
LockAllAttributesExcept

Obtém a coleção de atributos bloqueados.

(Herdado de ConfigurationElement)
LockAllElementsExcept

Obtém a coleção de elementos bloqueados.

(Herdado de ConfigurationElement)
LockAttributes

Obtém a coleção de atributos bloqueados.

(Herdado de ConfigurationElement)
LockElements

Obtém a coleção de elementos bloqueados.

(Herdado de ConfigurationElement)
LockItem

Obtém ou define um valor que indica se o elemento está bloqueado.

(Herdado de ConfigurationElement)
Properties

Obtém uma coleção de propriedades de configuração.

(Herdado de ProfilePropertySettingsCollection)
RemoveElementName

Obtém ou define o nome do ConfigurationElement a ser associado à operação de remoção no ConfigurationElementCollection quando substituído em uma classe derivada.

(Herdado de ConfigurationElementCollection)
SyncRoot

Obtém um objeto usado para sincronizar o acesso ao ConfigurationElementCollection.

(Herdado de ConfigurationElementCollection)
ThrowOnDuplicate

Obtém um valor que indica se um erro deve ser gerado se for feita uma tentativa de criar um objeto duplicado.

(Herdado de ProfilePropertySettingsCollection)

Métodos

Add(ProfilePropertySettings)

Adiciona um objeto de ProfilePropertySettings à coleção.

(Herdado de ProfilePropertySettingsCollection)
BaseAdd(ConfigurationElement)

Adiciona um elemento de configuração ao ConfigurationElementCollection.

(Herdado de ConfigurationElementCollection)
BaseAdd(ConfigurationElement, Boolean)

Adiciona um elemento de configuração à coleção de elementos de configuração.

(Herdado de ConfigurationElementCollection)
BaseAdd(Int32, ConfigurationElement)

Adiciona um elemento de configuração à coleção de elementos de configuração.

(Herdado de ConfigurationElementCollection)
BaseClear()

Remove todos os objetos de elemento de configuração da coleção.

(Herdado de ConfigurationElementCollection)
BaseGet(Int32)

Obtém o elemento de configuração no local do índice especificado.

(Herdado de ConfigurationElementCollection)
BaseGet(Object)

Retorna o elemento de configuração com a chave especificada.

(Herdado de ConfigurationElementCollection)
BaseGetAllKeys()

Retorna uma matriz das chaves para todos os elementos de configuração contidos no ConfigurationElementCollection.

(Herdado de ConfigurationElementCollection)
BaseGetKey(Int32)

Obtém a chave para o ConfigurationElement no local do índice especificado.

(Herdado de ConfigurationElementCollection)
BaseIndexOf(ConfigurationElement)

Indica o índice do ConfigurationElement especificado.

(Herdado de ConfigurationElementCollection)
BaseIsRemoved(Object)

Indica se o ConfigurationElement com a chave especificada foi removido do ConfigurationElementCollection.

(Herdado de ConfigurationElementCollection)
BaseRemove(Object)

Remove um ConfigurationElement da coleção.

(Herdado de ConfigurationElementCollection)
BaseRemoveAt(Int32)

Remove o ConfigurationElement no local de índice especificado.

(Herdado de ConfigurationElementCollection)
Clear()

Remove todos os objetos ProfilePropertySettings da coleção.

(Herdado de ProfilePropertySettingsCollection)
CopyTo(ConfigurationElement[], Int32)

Copia o conteúdo do ConfigurationElementCollection para uma matriz.

(Herdado de ConfigurationElementCollection)
CreateNewElement()

Quando substituído em uma classe derivada, cria um novo ConfigurationElement.

(Herdado de ProfilePropertySettingsCollection)
CreateNewElement(String)

Cria um novo ConfigurationElement quando substituído em uma classe derivada.

(Herdado de ConfigurationElementCollection)
DeserializeElement(XmlReader, Boolean)

Lê o XML do arquivo de configuração.

(Herdado de ConfigurationElement)
Equals(Object)

Compara o objeto RootProfilePropertySettingsCollection atual com outro objeto RootProfilePropertySettingsCollection.

Get(Int32)

Retorna o objeto ProfileSection no índice especificado.

(Herdado de ProfilePropertySettingsCollection)
Get(String)

Retorna o objeto ProfileSection com o nome especificado.

(Herdado de ProfilePropertySettingsCollection)
GetElementKey(ConfigurationElement)

Obtém a chave para o elemento de configuração especificado.

(Herdado de ProfilePropertySettingsCollection)
GetEnumerator()

Obtém um IEnumerator que é usado para iterar por meio de ConfigurationElementCollection.

(Herdado de ConfigurationElementCollection)
GetHashCode()

Gera um código hash para a coleção.

GetKey(Int32)

Obtém o nome do ProfilePropertySettings no local do índice especificado.

(Herdado de ProfilePropertySettingsCollection)
GetTransformedAssemblyString(String)

Retorna a versão transformada do nome do assembly especificado.

(Herdado de ConfigurationElement)
GetTransformedTypeString(String)

Retorna a versão transformada do nome do tipo especificado.

(Herdado de ConfigurationElement)
GetType()

Obtém o Type da instância atual.

(Herdado de Object)
IndexOf(ProfilePropertySettings)

Retorna o índice do objeto ProfilePropertySettings especificado.

(Herdado de ProfilePropertySettingsCollection)
Init()

Define o objeto ConfigurationElement para seu estado inicial.

(Herdado de ConfigurationElement)
InitializeDefault()

Usado para inicializar um conjunto padrão de valores para o objeto ConfigurationElement.

(Herdado de ConfigurationElement)
IsElementName(String)

Indica se o ConfigurationElement especificado existe no ConfigurationElementCollection.

(Herdado de ConfigurationElementCollection)
IsElementRemovable(ConfigurationElement)

Indica se o ConfigurationElement especificado pode ser removido de ConfigurationElementCollection.

(Herdado de ConfigurationElementCollection)
IsModified()

Indica se este ConfigurationElementCollection foi modificado desde a última vez em que foi salvo ou carregado quando substituído em uma classe derivada.

(Herdado de ConfigurationElementCollection)
IsReadOnly()

Indica se o objeto ConfigurationElementCollection é somente leitura.

(Herdado de ConfigurationElementCollection)
ListErrors(IList)

Adiciona os erros de propriedade inválida deste objeto ConfigurationElement e de todos os subelementos à lista passada.

(Herdado de ConfigurationElement)
MemberwiseClone()

Cria uma cópia superficial do Object atual.

(Herdado de Object)
OnDeserializeUnrecognizedAttribute(String, String)

Obtém um valor que indica se um atributo desconhecido é encontrado durante a desserialização.

(Herdado de ConfigurationElement)
OnDeserializeUnrecognizedElement(String, XmlReader)

Lida com a leitura de elementos de configuração não reconhecidos de um arquivo de configuração e faz com que o sistema de configuração lance uma exceção se o elemento não puder ser manipulado.

(Herdado de ProfilePropertySettingsCollection)
OnRequiredPropertyNotFound(String)

Gera uma exceção quando uma propriedade necessária não é encontrada.

(Herdado de ConfigurationElement)
PostDeserialize()

Chamado depois da desserialização.

(Herdado de ConfigurationElement)
PreSerialize(XmlWriter)

Chamado antes da serialização.

(Herdado de ConfigurationElement)
Remove(String)

Remove um objeto ProfilePropertySettings da coleção.

(Herdado de ProfilePropertySettingsCollection)
RemoveAt(Int32)

Remove um objeto ProfilePropertySettings no local do índice especificado da coleção.

(Herdado de ProfilePropertySettingsCollection)
Reset(ConfigurationElement)

Redefine o ConfigurationElementCollection para seu estado inalterado quando substituído em uma classe derivada.

(Herdado de ConfigurationElementCollection)
ResetModified()

Redefine o valor da propriedade IsModified() para false quando substituído em uma classe derivada.

(Herdado de ConfigurationElementCollection)
SerializeElement(XmlWriter, Boolean)

Grava os dados de configuração em um elemento XML no arquivo de configuração quando substituído em uma classe derivada.

(Herdado de ConfigurationElementCollection)
SerializeToXmlElement(XmlWriter, String)

Grava as marcas externas desse elemento de configuração no arquivo de configuração quando implementado em uma classe derivada.

(Herdado de ConfigurationElement)
Set(ProfilePropertySettings)

Adiciona o objeto ProfilePropertySettings especificado à coleção.

(Herdado de ProfilePropertySettingsCollection)
SetPropertyValue(ConfigurationProperty, Object, Boolean)

Define uma propriedade para o valor especificado.

(Herdado de ConfigurationElement)
SetReadOnly()

Define a propriedade IsReadOnly() para o objeto ConfigurationElementCollection e para todos os subelementos.

(Herdado de ConfigurationElementCollection)
ToString()

Retorna uma cadeia de caracteres que representa o objeto atual.

(Herdado de Object)
Unmerge(ConfigurationElement, ConfigurationElement, ConfigurationSaveMode)

Inverte o efeito da mesclagem de informações de configuração de diferentes níveis da hierarquia de configuração.

(Herdado de ConfigurationElementCollection)

Implantações explícitas de interface

ICollection.CopyTo(Array, Int32)

Copia o ConfigurationElementCollection para uma matriz.

(Herdado de ConfigurationElementCollection)

Métodos de Extensão

Cast<TResult>(IEnumerable)

Converte os elementos de um IEnumerable para o tipo especificado.

OfType<TResult>(IEnumerable)

Filtra os elementos de um IEnumerable com base em um tipo especificado.

AsParallel(IEnumerable)

Habilita a paralelização de uma consulta.

AsQueryable(IEnumerable)

Converte um IEnumerable em um IQueryable.

Aplica-se a

Confira também