ActivatedServiceTypeEntry Clase

Definición

Almacena valores de un tipo de objeto registrado en el servicio como un tipo que puede activarse cuando se solicita desde un cliente.

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
Herencia
ActivatedServiceTypeEntry
Atributos

Ejemplos

#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

Comentarios

El método usa la RemotingConfiguration.RegisterActivatedServiceType clase actual, que es el homólogo del lado servidor del RemotingConfiguration.RegisterActivatedClientType método . El RegisterActivatedServiceType método se usa en el servidor para permitir la activación remota por parte de los clientes de tipos de objeto especificados.

Para crear un objeto activado por el cliente en el servidor, debe conocer su Type, y debe registrarse en el extremo del servidor mediante el RegisterActivatedServiceType método . Para obtener un proxy para un nuevo objeto activado por el cliente, el cliente primero debe registrar un canal con ChannelServices y, a continuación, activar el objeto llamando a new o Activator.CreateInstance.

Para activar un tipo de objeto activado por el cliente con la new palabra clave , primero debe registrar el tipo de objeto en el cliente mediante el RegisterActivatedClientType método . Al llamar a RegisterActivatedClientType , proporciona a la infraestructura de comunicación remota la ubicación de la aplicación remota donde new intenta crearla. Por otro lado, si usa el CreateInstance método para crear una nueva instancia del objeto activado por el cliente, debe proporcionar la dirección URL de la aplicación remota como parámetro, por lo que no es necesario registrar previamente en el cliente. Para proporcionar el CreateInstance método con la dirección URL del servidor en el que desea crear el objeto, debe encapsular la dirección URL en una instancia de la UrlAttribute clase .

Para obtener una descripción detallada de los objetos activados por el cliente y la activación remota de objetos, consulte Activación de objetos remotos.

Constructores

ActivatedServiceTypeEntry(String, String)

Inicializa una nueva instancia de la clase ActivatedServiceTypeEntry con el nombre de tipo y el nombre de ensamblado especificados.

ActivatedServiceTypeEntry(Type)

Inicializa una nueva instancia de la clase ActivatedServiceTypeEntry con el valor de Type especificado.

Propiedades

AssemblyName

Obtiene el nombre del ensamblado del tipo de objeto configurado como tipo remoto activado.

(Heredado de TypeEntry)
ContextAttributes

Obtiene o establece los atributos de contexto para el tipo de servicio activado en el cliente.

ObjectType

Obtiene el valor de Type del tipo de servicio activado en el cliente.

TypeName

Obtiene el nombre de tipo completo del tipo de objeto configurado como tipo remoto activado.

(Heredado de TypeEntry)

Métodos

Equals(Object)

Determina si el objeto especificado es igual que el objeto actual.

(Heredado de Object)
GetHashCode()

Sirve como la función hash predeterminada.

(Heredado de Object)
GetType()

Obtiene el Type de la instancia actual.

(Heredado de Object)
MemberwiseClone()

Crea una copia superficial del Object actual.

(Heredado de Object)
ToString()

Devuelve el nombre de tipo y el nombre de ensamblado del tipo de servicio activado en el cliente en forma de String.

Se aplica a

Consulte también