ActivatedServiceTypeEntry Třída

Definice

Obsahuje hodnoty pro typ objektu zaregistrovaný na konci služby jako typ, který lze aktivovat na vyžádání od 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 se používá metodou RemotingConfiguration.RegisterActivatedServiceType , což je protějšek RemotingConfiguration.RegisterActivatedClientType metody na straně serveru. Metoda RegisterActivatedServiceType se používá na serveru k povolení vzdálené aktivace klienty zadaných typů objektů.

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

Chcete-li aktivovat typ objektu aktivovaný klientem s klíčovým slovem new , musíte nejprve zaregistrovat typ objektu v klientovi pomocí RegisterActivatedClientType metody. Voláním RegisterActivatedClientType dáte vzdálené infrastruktuře vzdálené komunikace umístění vzdálené aplikace, kde new se ji pokusí vytvořit. Pokud na druhou stranu 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 klienta. Chcete-li zadat metodu CreateInstance s adresou URL serveru, na kterém chcete vytvořit objekt, musíte zapouzdřením adresy URL v instanci UrlAttribute třídy.

Konstruktory

Name Description
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

Name Description
AssemblyName

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

(Zděděno od TypeEntry)
ContextAttributes

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

ObjectType

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

TypeName

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

(Zděděno od TypeEntry)

Metody

Name Description
Equals(Object)

Určuje, zda je zadaný objekt roven aktuálnímu objektu.

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

Slouží jako výchozí funkce hash.

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

Získá Type aktuální instance.

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

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

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

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

Platí pro

Viz také