ActivatedServiceTypeEntry Klasa
Definicja
Ważne
Niektóre informacje odnoszą się do produktu w wersji wstępnej, który może zostać znacząco zmodyfikowany przed wydaniem. Firma Microsoft nie udziela żadnych gwarancji, jawnych lub domniemanych, w odniesieniu do informacji podanych w tym miejscu.
Przechowuje wartości typu obiektu zarejestrowanego na końcu usługi jako wartości, które można aktywować na żądanie 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
- Dziedziczenie
- Atrybuty
Przykłady
#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
Uwagi
Bieżąca klasa jest używana przez metodę RemotingConfiguration.RegisterActivatedServiceType , która jest odpowiednikiem RemotingConfiguration.RegisterActivatedClientType metody po stronie serwera. Metoda RegisterActivatedServiceType jest używana na serwerze, aby umożliwić zdalną aktywację przez klientów określonych typów obiektów.
Aby utworzyć obiekt aktywowany przez klienta na serwerze, należy go znać Typei musi zostać zarejestrowany na końcu serwera przy użyciu RegisterActivatedServiceType metody . Aby uzyskać serwer proxy dla nowego obiektu aktywowanego przez klienta, klient musi najpierw zarejestrować kanał ChannelServices za pomocą polecenia , a następnie aktywować obiekt przez wywołanie new metody lub Activator.CreateInstance.
Aby aktywować typ obiektu aktywowanego przez klienta za new pomocą słowa kluczowego, należy najpierw zarejestrować typ obiektu na kliencie przy użyciu RegisterActivatedClientType metody . Wywołając polecenie RegisterActivatedClientType , udostępniasz infrastrukturę komunikacji zdalnej lokalizację aplikacji zdalnej, w której new próbuje ją utworzyć. Jeśli z drugiej strony użyjesz CreateInstance metody w celu utworzenia nowego wystąpienia obiektu aktywowanego przez klienta, musisz podać adres URL aplikacji zdalnej jako parametr, więc nie jest wymagana wcześniejsza rejestracja na kliencie. Aby podać metodę CreateInstance z adresem URL serwera, na którym chcesz utworzyć obiekt, należy hermetyzować adres URL w wystąpieniu UrlAttribute klasy.
Konstruktory
| Nazwa | Opis |
|---|---|
| ActivatedServiceTypeEntry(String, String) |
Inicjuje nowe wystąpienie ActivatedServiceTypeEntry klasy o podanej nazwie typu i nazwie zestawu. |
| ActivatedServiceTypeEntry(Type) |
Inicjuje nowe wystąpienie ActivatedServiceTypeEntry klasy przy użyciu danego Typeelementu . |
Właściwości
| Nazwa | Opis |
|---|---|
| AssemblyName |
Pobiera nazwę zestawu typu obiektu skonfigurowanego jako typ aktywowany zdalnie. (Odziedziczone po TypeEntry) |
| ContextAttributes |
Pobiera lub ustawia atrybuty kontekstu dla typu usługi aktywowanej przez klienta. |
| ObjectType |
Type Pobiera typ usługi aktywowanej przez klienta. |
| TypeName |
Pobiera pełną nazwę typu obiektu skonfigurowanego jako typ aktywowany zdalnie. (Odziedziczone po TypeEntry) |
Metody
| Nazwa | Opis |
|---|---|
| Equals(Object) |
Określa, czy dany obiekt jest taki sam, jak bieżący obiekt. (Odziedziczone po Object) |
| GetHashCode() |
Służy jako domyślna funkcja skrótu. (Odziedziczone po Object) |
| GetType() |
Pobiera Type bieżącego wystąpienia. (Odziedziczone po Object) |
| MemberwiseClone() |
Tworzy płytkią kopię bieżącego Object. (Odziedziczone po Object) |
| ToString() |
Zwraca typ i nazwę zestawu typu usługi aktywowanej przez klienta jako String. |