次の方法で共有


ActivatedServiceTypeEntry クラス

定義

サービス エンドに登録されているオブジェクトの種類の値を、クライアントからの要求時にアクティブ化できるオブジェクトの種類として保持します。

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
継承
ActivatedServiceTypeEntry
属性

#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

注釈

現在のクラスは、RemotingConfiguration.RegisterActivatedClientType メソッドに対応するサーバー側のRemotingConfiguration.RegisterActivatedServiceType メソッドによって使用されます。 RegisterActivatedServiceType メソッドは、指定したオブジェクトの種類のクライアントによるリモート アクティブ化を許可するために、サーバーで使用されます。

サーバー上にクライアントアクティブ化オブジェクトを作成するには、その Typeを把握している必要があります。また、 RegisterActivatedServiceType メソッドを使用してサーバー 側に登録する必要があります。 新しいクライアントでアクティブ化されたオブジェクトのプロキシを取得するには、クライアントは最初にチャネルを ChannelServices に登録してから、 new または Activator.CreateInstanceを呼び出してオブジェクトをアクティブ化する必要があります。

new キーワードを使用してクライアントでアクティブ化されたオブジェクトの種類をアクティブにするには、まず、RegisterActivatedClientType メソッドを使用してクライアントにオブジェクトの種類を登録する必要があります。 RegisterActivatedClientTypeを呼び出すことで、リモート処理インフラストラクチャにリモート アプリケーションの場所new作成を試みます。 一方、 CreateInstance メソッドを使用してクライアントアクティブ化オブジェクトの新しいインスタンスを作成する場合は、リモート アプリケーションの URL をパラメーターとして指定する必要があるため、クライアントに事前に登録する必要はありません。 CreateInstance メソッドに、オブジェクトを作成するサーバーの URL を指定するには、UrlAttribute クラスのインスタンスに URL をカプセル化する必要があります。

コンストラクター

名前 説明
ActivatedServiceTypeEntry(String, String)

指定した型名とアセンブリ名を使用して、 ActivatedServiceTypeEntry クラスの新しいインスタンスを初期化します。

ActivatedServiceTypeEntry(Type)

指定したTypeを使用して、ActivatedServiceTypeEntry クラスの新しいインスタンスを初期化します。

プロパティ

名前 説明
AssemblyName

リモートアクティブ化された型として構成されたオブジェクト型のアセンブリ名を取得します。

(継承元 TypeEntry)
ContextAttributes

クライアントによってアクティブ化されるサービスの種類のコンテキスト属性を取得または設定します。

ObjectType

クライアントによってアクティブ化されたサービスの種類の Type を取得します。

TypeName

リモートアクティブ化された型として構成されたオブジェクト型の完全な型名を取得します。

(継承元 TypeEntry)

メソッド

名前 説明
Equals(Object)

指定されたオブジェクトが現在のオブジェクトと等しいかどうかを判断します。

(継承元 Object)
GetHashCode()

既定のハッシュ関数として機能します。

(継承元 Object)
GetType()

現在のインスタンスの Type を取得します。

(継承元 Object)
MemberwiseClone()

現在の Objectの簡易コピーを作成します。

(継承元 Object)
ToString()

クライアントによってアクティブ化されたサービスの種類の型とアセンブリ名を Stringとして返します。

適用対象

こちらもご覧ください