InterfaceQueuingAttribute Classe

Definição

Habilita o suporte de enfileiramento para a interface marcada. Essa classe não pode ser herdada.

public ref class InterfaceQueuingAttribute sealed : Attribute
[System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Interface, AllowMultiple=true, Inherited=true)]
[System.Runtime.InteropServices.ComVisible(false)]
public sealed class InterfaceQueuingAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Interface, AllowMultiple=true, Inherited=true)>]
[<System.Runtime.InteropServices.ComVisible(false)>]
type InterfaceQueuingAttribute = class
    inherit Attribute
Public NotInheritable Class InterfaceQueuingAttribute
Inherits Attribute
Herança
InterfaceQueuingAttribute
Atributos

Exemplos

O exemplo de código a seguir mostra como usar o InterfaceQueuingAttribute atributo .

public interface class IQueuedComponent
{
   void QueuedTask();
};


// Mark IQueuedComponent interface as queued
// Create the queued component class by inheriting the 
// System.EnterpriseServices.ServicedComponent class and an
// interface that is marked as queued with the InterfaceQueuing attribute

[InterfaceQueuing(true,Interface="IQueuedComponent")]
public ref class QueuedComponent sealed: public ServicedComponent, public IQueuedComponent
{
public:
   virtual void QueuedTask()
   {
      // Perform queued task here
   }

};
public interface IQueuedComponent
{
    void QueuedTask();
}
// Mark IQueuedComponent interface as queued
[InterfaceQueuing(true, Interface="IQueuedComponent")]
// Create the queued component class by inheriting the
// System.EnterpriseServices.ServicedComponent class and an
// interface that is marked as queued with the InterfaceQueuing attribute
public class QueuedComponent : ServicedComponent, IQueuedComponent
{
    public void QueuedTask()
    {
        // Perform queued task here
    }
}

O exemplo de código a seguir mostra como marcar um aplicativo COM+ como enfileirado em tempo de compilação usando o ApplicationQueuing atributo e habilitar o ouvinte COM+ definindo como QueueListenerEnabled true

// Mark the COM+ application as queued at compile time by using the 
// ApplicationQueuing attribute. Enable the COM+ listener by 
// setting the QueueListenerEnabled to true
[assembly:ApplicationQueuing(Enabled=true,QueueListenerEnabled=true)];
// Mark the COM+ application as queued at compile time by using the
// ApplicationQueuing attribute. Enable the COM+ listener by
// setting the QueueListenerEnabled to true
[assembly: ApplicationQueuing(Enabled=true, QueueListenerEnabled=true)]

O exemplo de código a seguir mostra como usar BindToMoniker para executar o moniker enfileirado, para obter uma instância do gravador, chamar o método que será gravado e forçar a liberação do objeto gravador para enviar a mensagem para a fila.

// Use BindToMoniker to run the queued moniker, to get an instance of the recorder
IQueuedComponent ^ qc = dynamic_cast<IQueuedComponent^>(System::Runtime::InteropServices::Marshal::BindToMoniker( "queue:/new:QueuedComponent" ));

// Call the method that will be recorded
qc->QueuedTask();

// Force the release of the recorder object, to send the message to the queue
System::Runtime::InteropServices::Marshal::ReleaseComObject( qc );
// Use BindToMoniker to run the queued moniker, to get an instance of the recorder
IQueuedComponent qc =
    (IQueuedComponent)System.Runtime.InteropServices.Marshal.BindToMoniker("queue:/new:QueuedComponent");
// Call the method that will be recorded
qc.QueuedTask();

// Force the release of the recorder object, to send the message to the queue
System.Runtime.InteropServices.Marshal.ReleaseComObject(qc);

Comentários

As chamadas nessa interface serão enfileiradas usando o Enfileiramento de Mensagens.

Para marcar uma interface como enfileirada, aplique esse atributo à interface usando a seguinte sintaxe: [InterfaceQueuing].

Os métodos membro de uma interface enfileirada devem atender aos requisitos para chamadas de método enfileiradas, como não ter parâmetros out ou ref .

Para obter mais informações sobre como usar atributos, consulte Atributos.

Construtores

InterfaceQueuingAttribute()

Inicializa uma nova instância da classe InterfaceQueuingAttribute definindo as propriedades Enabled e Interface com seus valores padrão.

InterfaceQueuingAttribute(Boolean)

Inicializa uma nova instância da classe InterfaceQueuingAttribute, desabilitando opcionalmente o suporte ao enfileiramento.

Propriedades

Enabled

Obtém ou define um valor que indica se o suporte ao enfileiramento está habilitado.

Interface

Obtém ou define o nome da interface em que o enfileiramento está habilitado.

TypeId

Quando implementado em uma classe derivada, obtém um identificador exclusivo para este Attribute.

(Herdado de Attribute)

Métodos

Equals(Object)

Retorna um valor que indica se essa instância é igual a um objeto especificado.

(Herdado de Attribute)
GetHashCode()

Retorna o código hash para a instância.

(Herdado de Attribute)
GetType()

Obtém o Type da instância atual.

(Herdado de Object)
IsDefaultAttribute()

Quando substituído em uma classe derivada, indica se o valor dessa instância é o valor padrão para a classe derivada.

(Herdado de Attribute)
Match(Object)

Quando substituído em uma classe derivada, retorna um valor que indica se essa instância é igual a um objeto especificado.

(Herdado de Attribute)
MemberwiseClone()

Cria uma cópia superficial do Object atual.

(Herdado de Object)
ToString()

Retorna uma cadeia de caracteres que representa o objeto atual.

(Herdado de Object)

Implantações explícitas de interface

_Attribute.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr)

Mapeia um conjunto de nomes para um conjunto correspondente de identificadores de expedição.

(Herdado de Attribute)
_Attribute.GetTypeInfo(UInt32, UInt32, IntPtr)

Recupera as informações de tipo para um objeto, que pode ser usado para obter as informações de tipo para uma interface.

(Herdado de Attribute)
_Attribute.GetTypeInfoCount(UInt32)

Retorna o número de interfaces de informações do tipo que um objeto fornece (0 ou 1).

(Herdado de Attribute)
_Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)

Fornece acesso a propriedades e métodos expostos por um objeto.

(Herdado de Attribute)

Aplica-se a