InterfaceQueuingAttribute Klasse

Definition

Aktiviert Warteschlangenunterstützung für die markierte Schnittstelle. Diese Klasse kann nicht vererbt werden.

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
Vererbung
InterfaceQueuingAttribute
Attribute

Beispiele

Im folgenden Codebeispiel wird gezeigt, wie das InterfaceQueuingAttribute Attribut verwendet wird.

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

Das folgende Codebeispiel zeigt, wie Sie eine COM+-Anwendung mithilfe des ApplicationQueuing Attributs als com+-Anwendung in die Warteschlange stellen und den COM+-Listener aktivieren, indem Sie den QueueListenerEnabled Wert auf "true" festlegen.

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

Im folgenden Codebeispiel wird gezeigt, wie BindToMoniker Sie den in die Warteschlange gestellten Moniker ausführen, um eine Instanz der Aufzeichnung abzurufen, die aufgezeichnete Methode aufzurufen und die Freigabe des Aufzeichnungsobjekts zu erzwingen, um die Nachricht an die Warteschlange zu senden.

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

Hinweise

Aufrufe dieser Schnittstelle werden mithilfe von Message Queuing in die Warteschlange gestellt.

Um eine Schnittstelle als Warteschlange zu markieren, wenden Sie dieses Attribut mithilfe der folgenden Syntax auf die Schnittstelle an: [InterfaceQueuing]

Die Membermethoden einer Warteschlange-Schnittstelle müssen die Anforderungen für Warteschlangenmethodenaufrufe erfüllen, z. B. ohne out Parameter ref .

Weitere Informationen zur Verwendung von Attributen finden Sie unter Attribute.

Konstruktoren

InterfaceQueuingAttribute()

Initialisiert eine neue Instanz der InterfaceQueuingAttribute-Klasse und legt die Enabled-Eigenschaft und die Interface-Eigenschaft auf deren Standardwerte fest.

InterfaceQueuingAttribute(Boolean)

Initialisiert eine neue Instanz der InterfaceQueuingAttribute-Klasse und deaktiviert dabei optional die Warteschlangenunterstützung.

Eigenschaften

Enabled

Ruft einen Wert ab, der angibt, ob die Warteschlangenunterstützung aktiviert ist, oder legt diesen fest.

Interface

Ruft den Namen der Schnittstelle ab, für die die Warteschlangenunterstützung aktiviert ist, oder legt diesen fest.

TypeId

Ruft bei Implementierung in einer abgeleiteten Klasse einen eindeutigen Bezeichner für dieses Attribute ab.

(Geerbt von Attribute)

Methoden

Equals(Object)

Gibt einen Wert zurück, der angibt, ob diese Instanz gleich einem angegebenen Objekt ist.

(Geerbt von Attribute)
GetHashCode()

Gibt den Hashcode für diese Instanz zurück.

(Geerbt von Attribute)
GetType()

Ruft den Type der aktuellen Instanz ab.

(Geerbt von Object)
IsDefaultAttribute()

Gibt beim Überschreiben in einer abgeleiteten Klasse an, ob der Wert der Instanz der Standardwert für die abgeleitete Klasse ist.

(Geerbt von Attribute)
Match(Object)

Beim Überschreiben in einer abgeleiteten Klasse wird ein Wert zurückgegeben, der angibt, ob diese Instanz einem bestimmten Objekt entspricht.

(Geerbt von Attribute)
MemberwiseClone()

Erstellt eine flache Kopie des aktuellen Object.

(Geerbt von Object)
ToString()

Gibt eine Zeichenfolge zurück, die das aktuelle Objekt darstellt.

(Geerbt von Object)

Explizite Schnittstellenimplementierungen

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

Ordnet eine Reihe von Namen einer entsprechenden Reihe von Dispatchbezeichnern zu.

(Geerbt von Attribute)
_Attribute.GetTypeInfo(UInt32, UInt32, IntPtr)

Ruft die Typinformationen für ein Objekt ab, mit deren Hilfe die Typinformationen für eine Schnittstelle abgerufen werden können.

(Geerbt von Attribute)
_Attribute.GetTypeInfoCount(UInt32)

Ruft die Anzahl der Schnittstellen mit Typinformationen ab, die von einem Objekt bereitgestellt werden (0 oder 1).

(Geerbt von Attribute)
_Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)

Stellt den Zugriff auf von einem Objekt verfügbar gemachte Eigenschaften und Methoden bereit.

(Geerbt von Attribute)

Gilt für