InterfaceQueuingAttribute Klass

Definition

Aktiverar köstöd för det markerade gränssnittet. Det går inte att ärva den här klassen.

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
Arv
InterfaceQueuingAttribute
Attribut

Exempel

Följande kodexempel visar hur du använder attributet 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
    }
}

I följande kodexempel visas hur du markerar ett COM+-program som i kö vid kompileringstillfället med hjälp ApplicationQueuing av attributet och aktiverar COM+-lyssnaren genom att ställa in värdet 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)]

Följande kodexempel visar hur du använder BindToMoniker för att köra den i köade monikern, för att hämta en instans av inspelaren, anropa den metod som ska spelas in och framtvinga lanseringen av inspelarens objekt för att skicka meddelandet till kön.

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

Kommentarer

Samtal i det här gränssnittet placeras i kö med hjälp av Message Queuing.

Om du vill markera ett gränssnitt som i kö använder du det här attributet i gränssnittet med hjälp av följande syntax: [InterfaceQueuing].

Medlemsmetoderna i ett köat gränssnitt måste uppfylla kraven för köade metodanrop, till exempel att ha inga out eller ref parametrar.

Mer information om hur du använder attribut finns i Attribut.

Konstruktorer

Name Description
InterfaceQueuingAttribute()

Initierar en ny instans av InterfaceQueuingAttribute klassen som anger Enabled egenskaperna och Interface till deras standardvärden.

InterfaceQueuingAttribute(Boolean)

Initierar en ny instans av InterfaceQueuingAttribute klassen och inaktiverar eventuellt stöd för köer.

Egenskaper

Name Description
Enabled

Hämtar eller anger ett värde som anger om köstöd är aktiverat.

Interface

Hämtar eller anger namnet på det gränssnitt där köer är aktiverade.

TypeId

När den implementeras i en härledd klass hämtar du en unik identifierare för den här Attribute.

(Ärvd från Attribute)

Metoder

Name Description
Equals(Object)

Returnerar ett värde som anger om den här instansen är lika med ett angivet objekt.

(Ärvd från Attribute)
GetHashCode()

Returnerar hash-koden för den här instansen.

(Ärvd från Attribute)
GetType()

Hämtar den aktuella instansen Type .

(Ärvd från Object)
IsDefaultAttribute()

När den åsidosättas i en härledd klass anger du om värdet för den här instansen är standardvärdet för den härledda klassen.

(Ärvd från Attribute)
Match(Object)

När den åsidosätts i en härledd klass returneras ett värde som anger om den här instansen är lika med ett angivet objekt.

(Ärvd från Attribute)
MemberwiseClone()

Skapar en ytlig kopia av den aktuella Object.

(Ärvd från Object)
ToString()

Returnerar en sträng som representerar det aktuella objektet.

(Ärvd från Object)

Explicita gränssnittsimplementeringar

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

Mappar en uppsättning namn till en motsvarande uppsättning av sändningsidentifierare.

(Ärvd från Attribute)
_Attribute.GetTypeInfo(UInt32, UInt32, IntPtr)

Hämtar typinformationen för ett objekt, som kan användas för att hämta typinformationen för ett gränssnitt.

(Ärvd från Attribute)
_Attribute.GetTypeInfoCount(UInt32)

Hämtar antalet typinformationsgränssnitt som ett objekt tillhandahåller (antingen 0 eller 1).

(Ärvd från Attribute)
_Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)

Ger åtkomst till egenskaper och metoder som exponeras av ett objekt.

(Ärvd från Attribute)

Gäller för