InterfaceQueuingAttribute Classe
Definição
Importante
Algumas informações se referem a produtos de pré-lançamento que podem ser substancialmente modificados antes do lançamento. A Microsoft não oferece garantias, expressas ou implícitas, das informações aqui fornecidas.
Habilita o suporte à fila 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
- 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 no 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 na fila, 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 na fila, como não ter parâmetros ou ref nãoout.
Para obter mais informações sobre como usar atributos, consulte Atributos.
Construtores
| Nome | Description |
|---|---|
| InterfaceQueuingAttribute() |
Inicializa uma nova instância da InterfaceQueuingAttribute classe definindo as propriedades e Interface as Enabled propriedades como seus valores padrão. |
| InterfaceQueuingAttribute(Boolean) |
Inicializa uma nova instância da classe, opcionalmente desabilitando o InterfaceQueuingAttribute suporte à fila. |
Propriedades
| Nome | Description |
|---|---|
| Enabled |
Obtém ou define um valor que indica se o suporte à fila está habilitado. |
| Interface |
Obtém ou define o nome da interface na qual a fila está habilitada. |
| TypeId |
Quando implementado em uma classe derivada, obtém um identificador exclusivo para esse Attribute. (Herdado de Attribute) |
Métodos
| Nome | Description |
|---|---|
| Equals(Object) |
Retorna um valor que indica se essa instância é igual a um objeto especificado. (Herdado de Attribute) |
| GetHashCode() |
Devolve o código hash para esta 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 Objectatual. (Herdado de Object) |
| ToString() |
Retorna uma cadeia de caracteres que representa o objeto atual. (Herdado de Object) |
Implantações explícitas de interface
| Nome | Description |
|---|---|
| _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 de um objeto, que podem ser usadas para obter as informações de tipo de 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) |