ActivatedServiceTypeEntry Třída

Definice

Obsahuje hodnoty pro typ objektu zaregistrovaný na konci služby jako objekt, který lze aktivovat na žádost klienta.

public ref class ActivatedServiceTypeEntry : System::Runtime::Remoting::TypeEntry
public class ActivatedServiceTypeEntry : System.Runtime.Remoting.TypeEntry
[System.Runtime.InteropServices.ComVisible(true)]
public class ActivatedServiceTypeEntry : System.Runtime.Remoting.TypeEntry
type ActivatedServiceTypeEntry = class
    inherit TypeEntry
[<System.Runtime.InteropServices.ComVisible(true)>]
type ActivatedServiceTypeEntry = class
    inherit TypeEntry
Public Class ActivatedServiceTypeEntry
Inherits TypeEntry
Dědičnost
ActivatedServiceTypeEntry
Atributy

Příklady

#using <System.Runtime.Remoting.dll>
#using <ActivatedServiceTypeEntry_ObjectType_Share.dll>

using namespace System;
using namespace System::Runtime::Remoting;
using namespace System::Runtime::Remoting::Channels;
using namespace System::Runtime::Remoting::Channels::Tcp;
void main()
{
   ChannelServices::RegisterChannel( gcnew TcpChannel( 8082 ) );
   
   // Create an instance of 'ActivatedServiceTypeEntry' class
   // which holds the values for 'HelloServer' type.
   ActivatedServiceTypeEntry^ myActivatedServiceTypeEntry =
      gcnew ActivatedServiceTypeEntry( HelloServer::typeid );
   
   // Register an object Type on the service end so that 
   // it can be activated on request from a client.
   RemotingConfiguration::RegisterActivatedServiceType(
      myActivatedServiceTypeEntry );
   
   // Get the registered activated service types.
   array<ActivatedServiceTypeEntry^>^ activatedServiceEntries =
      RemotingConfiguration::GetRegisteredActivatedServiceTypes();
   Console::WriteLine( "Information of first registered activated" +
     " service type :" );
   Console::WriteLine( "Object type: {0}",
      activatedServiceEntries[ 0 ]->ObjectType->ToString() );
   Console::WriteLine( "Description: {0}",
      activatedServiceEntries[ 0 ]->ToString() );

   Console::WriteLine( "Press enter to stop this process" );
   Console::ReadLine();
}
using System;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Tcp;

public class MyClient
{
   public static void Main()
   {
      ChannelServices.RegisterChannel(new TcpChannel(8082));
      // Create an instance of 'ActivatedServiceTypeEntry' class
      // which holds the values for 'HelloServer' type.
      ActivatedServiceTypeEntry myActivatedServiceTypeEntry =
                   new ActivatedServiceTypeEntry(typeof(HelloServer));
      // Register an object Type on the service end so that
      // it can be activated on request from a client.
      RemotingConfiguration.RegisterActivatedServiceType(
                                         myActivatedServiceTypeEntry);
      // Get the registered activated service types .
      ActivatedServiceTypeEntry[] myActivatedServiceEntries =
          RemotingConfiguration.GetRegisteredActivatedServiceTypes();
      Console.WriteLine("Information of first registered activated "
                             +" service type :");
      Console.WriteLine("Object type: "
                       +myActivatedServiceEntries[0].ObjectType);
      Console.WriteLine("Description: "
                           +myActivatedServiceEntries[0].ToString());
      Console.WriteLine("Press enter to stop this process");
      Console.ReadLine();
   }
}
Imports System.Runtime.Remoting
Imports System.Runtime.Remoting.Channels
Imports System.Runtime.Remoting.Channels.Tcp

Public Class MyClient
   
   Public Shared Sub Main()
      ChannelServices.RegisterChannel(New TcpChannel(8082))
      ' Create an instance of 'ActivatedServiceTypeEntry' class
      ' which holds the values for 'HelloServer' type.
      Dim myActivatedServiceTypeEntry As New ActivatedServiceTypeEntry(GetType(HelloServer))
      ' Register an object Type on the service end so that 
      ' it can be activated on request from a client.
      RemotingConfiguration.RegisterActivatedServiceType(myActivatedServiceTypeEntry)
      ' Get the registered activated service types .
      Dim myActivatedServiceEntries As ActivatedServiceTypeEntry() = RemotingConfiguration. _
                                                         GetRegisteredActivatedServiceTypes()
      Console.WriteLine("Information of first registered activated " + " service type :")
      Console.WriteLine("Object type: " + myActivatedServiceEntries(0).ObjectType.ToString())
      Console.WriteLine("Description: " + myActivatedServiceEntries(0).ToString())
      Console.WriteLine("Press enter to stop this process")
      Console.ReadLine()
   End Sub
End Class

Poznámky

Aktuální třída je používána metodou RemotingConfiguration.RegisterActivatedServiceType , což je protějšek metody na RemotingConfiguration.RegisterActivatedClientType straně serveru. Metoda RegisterActivatedServiceType se na serveru používá k povolení vzdálené aktivace klienty zadaných typů objektů.

Chcete-li vytvořit objekt aktivovaný klientem na serveru, musíte znát jeho Typeobjekt a musí být zaregistrován na straně serveru pomocí RegisterActivatedServiceType metody . Pokud chcete získat proxy pro nový objekt aktivovaný klientem, musí klient nejprve zaregistrovat kanál pomocí ChannelServices a pak aktivovat objekt voláním new nebo Activator.CreateInstance.

Chcete-li aktivovat typ objektu aktivovaný klientem pomocí klíčového new slova, musíte nejprve zaregistrovat typ objektu v klientovi pomocí RegisterActivatedClientType metody . Voláním RegisterActivatedClientType poskytnete infrastruktuře vzdálené komunikace umístění vzdálené aplikace, kde new se ji pokusí vytvořit. Pokud na druhé straně použijete metodu CreateInstance k vytvoření nové instance objektu aktivovaného klientem, musíte jako parametr zadat adresu URL vzdálené aplikace, takže není nutná žádná předchozí registrace na klientovi. Chcete-li zadat metodu CreateInstance s adresou URL serveru, na kterém chcete vytvořit objekt, musíte zapouzdřit adresu URL v instanci UrlAttribute třídy.

Podrobný popis objektů aktivovaných klientem a vzdálené aktivace objektů najdete v tématu Aktivace vzdálených objektů.

Konstruktory

ActivatedServiceTypeEntry(String, String)

Inicializuje novou instanci ActivatedServiceTypeEntry třídy s daným názvem typu a názvem sestavení.

ActivatedServiceTypeEntry(Type)

Inicializuje novou instanci ActivatedServiceTypeEntry třídy s danou Type.

Vlastnosti

AssemblyName

Získá název sestavení typu objektu nakonfigurovaný jako typ vzdálené aktivace.

(Zděděno od TypeEntry)
ContextAttributes

Získá nebo nastaví atributy kontextu pro typ služby aktivované klientem.

ObjectType

Type Získá typ služby aktivované klientem.

TypeName

Získá úplný název typu objektu typ nakonfigurovaný být vzdáleně aktivovaný typ.

(Zděděno od TypeEntry)

Metody

Equals(Object)

Určí, zda se zadaný objekt rovná aktuálnímu objektu.

(Zděděno od Object)
GetHashCode()

Slouží jako výchozí hashovací funkce.

(Zděděno od Object)
GetType()

Získá aktuální Type instanci.

(Zděděno od Object)
MemberwiseClone()

Vytvoří mělkou kopii aktuálního Objectsouboru .

(Zděděno od Object)
ToString()

Vrátí typ a název sestavení typu služby aktivované klientem Stringjako .

Platí pro

Viz také