InterfaceQueuingAttribute Klasa

Definicja

Umożliwia obsługę kolejkowania dla oznaczonego interfejsu. Klasa ta nie może być dziedziczona.

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
Dziedziczenie
InterfaceQueuingAttribute
Atrybuty

Przykłady

W poniższym przykładzie kodu pokazano, jak używać atrybutu InterfaceQueuingAttribute .

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
    }
}

Poniższy przykład kodu pokazuje, jak oznaczyć aplikację COM+ jako w kolejce w czasie kompilacji przy użyciu atrybutu ApplicationQueuing i włączyć odbiornik COM+ przez ustawienie wartości 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)]

W poniższym przykładzie kodu pokazano, jak uruchomić BindToMoniker w kolejce moniker, aby uzyskać wystąpienie rejestratora, wywołać metodę, która zostanie zarejestrowana, i wymusić zwolnienie obiektu rejestratora w celu wysłania komunikatu do kolejki.

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

Uwagi

Wywołania tego interfejsu będą kolejkowane przy użyciu kolejkowania komunikatów.

Aby oznaczyć interfejs jako w kolejce, zastosuj ten atrybut do interfejsu przy użyciu następującej składni: [InterfaceQueuing].

Metody składowe interfejsu w kolejce muszą spełniać wymagania dotyczące wywołań metody w kolejce, takich jak brak out parametrów lub ref .

Aby uzyskać więcej informacji na temat używania atrybutów, zobacz Atrybuty.

Konstruktory

InterfaceQueuingAttribute()

Inicjuje InterfaceQueuingAttribute nowe wystąpienie klasy, ustawiając Enabled właściwości i Interface na ich wartości domyślne.

InterfaceQueuingAttribute(Boolean)

Inicjuje InterfaceQueuingAttribute nowe wystąpienie klasy, opcjonalnie wyłączając obsługę kolejkowania.

Właściwości

Enabled

Pobiera lub ustawia wartość wskazującą, czy obsługa kolejkowania jest włączona.

Interface

Pobiera lub ustawia nazwę interfejsu, w którym włączono kolejkowanie.

TypeId

Po zaimplementowaniu w klasie pochodnej pobiera unikatowy identyfikator dla tego Attributeelementu .

(Odziedziczone po Attribute)

Metody

Equals(Object)

Zwraca wartość wskazującą, czy to wystąpienie jest równe podanemu obiektowi.

(Odziedziczone po Attribute)
GetHashCode()

Zwraca wartość skrótu dla tego wystąpienia.

(Odziedziczone po Attribute)
GetType()

Type Pobiera wartość bieżącego wystąpienia.

(Odziedziczone po Object)
IsDefaultAttribute()

W przypadku zastąpienia w klasie pochodnej wskazuje, czy wartość tego wystąpienia jest wartością domyślną klasy pochodnej.

(Odziedziczone po Attribute)
Match(Object)

Po przesłonięciu w klasie pochodnej zwraca wartość wskazującą, czy to wystąpienie jest równe określonemu obiektowi.

(Odziedziczone po Attribute)
MemberwiseClone()

Tworzy płytkią kopię bieżącego Objectelementu .

(Odziedziczone po Object)
ToString()

Zwraca ciąg reprezentujący bieżący obiekt.

(Odziedziczone po Object)

Jawne implementacje interfejsu

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

Zestaw nazw jest mapowany na odpowiedni zestaw identyfikatorów wysyłania.

(Odziedziczone po Attribute)
_Attribute.GetTypeInfo(UInt32, UInt32, IntPtr)

Pobiera informacje o typie dla obiektu, który może służyć do pobierania informacji o typie dla interfejsu.

(Odziedziczone po Attribute)
_Attribute.GetTypeInfoCount(UInt32)

Pobiera informację o liczbie typów interfejsów, jakie zawiera obiekt (0 lub 1).

(Odziedziczone po Attribute)
_Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)

Umożliwia dostęp do właściwości i metod udostępnianych przez obiekt.

(Odziedziczone po Attribute)

Dotyczy