ActivatedServiceTypeEntry Classe
Definição
Importante
Algumas informações se referem a produtos de pré-lançamento que podem ser substancialmente modificados antes do lançamento. A Microsoft não oferece garantias, expressas ou implícitas, das informações aqui fornecidas.
Contém valores para um tipo de objeto registrado na extremidade do serviço como um que pode ser ativado sob solicitação de um 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
- Herança
- Atributos
Exemplos
#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
Comentários
A classe atual é usada pelo RemotingConfiguration.RegisterActivatedServiceType método, que é o equivalente do lado do servidor do RemotingConfiguration.RegisterActivatedClientType método. O RegisterActivatedServiceType método é usado no servidor para permitir a ativação remota por clientes de tipos de objeto especificados.
Para criar um objeto ativado pelo cliente no servidor, você deve saber o seu Typee ele deve ser registrado na extremidade do servidor usando o RegisterActivatedServiceType método. Para obter um proxy para um novo objeto ativado pelo cliente, o cliente deve primeiro registrar um canal e ChannelServices ativar o objeto chamando new ou Activator.CreateInstance.
Para ativar um tipo de objeto ativado pelo cliente com a new palavra-chave, primeiro registre o tipo de objeto no cliente usando o RegisterActivatedClientType método. Ao chamar RegisterActivatedClientType você, você está fornecendo à infraestrutura de comunicação remota o local do aplicativo remoto em new que tenta criá-lo. Se, por outro lado, você usar o CreateInstance método para criar uma nova instância do objeto ativado pelo cliente, deverá fornecer a URL do aplicativo remoto como um parâmetro, portanto, nenhum registro anterior no cliente será necessário. Para fornecer o CreateInstance método com a URL do servidor no qual você deseja criar o objeto, você deve encapsular a URL em uma instância da UrlAttribute classe.
Construtores
| Nome | Description |
|---|---|
| ActivatedServiceTypeEntry(String, String) |
Inicializa uma nova instância da ActivatedServiceTypeEntry classe com o nome de tipo e o nome do assembly fornecidos. |
| ActivatedServiceTypeEntry(Type) |
Inicializa uma nova instância da ActivatedServiceTypeEntry classe com o determinado Type. |
Propriedades
| Nome | Description |
|---|---|
| AssemblyName |
Obtém o nome do assembly do tipo de objeto configurado para ser um tipo ativado remotamente. (Herdado de TypeEntry) |
| ContextAttributes |
Obtém ou define os atributos de contexto para o tipo de serviço ativado pelo cliente. |
| ObjectType |
Obtém o Type tipo de serviço ativado pelo cliente. |
| TypeName |
Obtém o nome de tipo completo do tipo de objeto configurado para ser um tipo ativado remotamente. (Herdado de TypeEntry) |
Métodos
| Nome | Description |
|---|---|
| Equals(Object) |
Determina se o objeto especificado é igual ao objeto atual. (Herdado de Object) |
| GetHashCode() |
Serve como a função de hash padrão. (Herdado de Object) |
| GetType() |
Obtém o Type da instância atual. (Herdado de Object) |
| MemberwiseClone() |
Cria uma cópia superficial do Objectatual. (Herdado de Object) |
| ToString() |
Retorna o tipo e o nome do assembly do tipo de serviço ativado pelo cliente como um String. |