ClientBase<TChannel> クラス

定義

サービスを呼び出すことができる Windows Communication Foundation (WCF) クライアント オブジェクトの作成に使用される基本実装を提供します。

generic <typename TChannel>
 where TChannel : classpublic ref class ClientBase abstract : System::ServiceModel::ICommunicationObject
generic <typename TChannel>
 where TChannel : classpublic ref class ClientBase abstract : IAsyncDisposable, IDisposable, System::ServiceModel::ICommunicationObject
generic <typename TChannel>
 where TChannel : classpublic ref class ClientBase abstract : IDisposable, System::ServiceModel::ICommunicationObject
public abstract class ClientBase<TChannel> : System.ServiceModel.ICommunicationObject where TChannel : class
public abstract class ClientBase<TChannel> : IAsyncDisposable, IDisposable, System.ServiceModel.ICommunicationObject where TChannel : class
public abstract class ClientBase<TChannel> : IDisposable, System.ServiceModel.ICommunicationObject where TChannel : class
type ClientBase<'Channel (requires 'Channel : null)> = class
    interface ICommunicationObject
type ClientBase<'Channel (requires 'Channel : null)> = class
    interface ICommunicationObject
    interface IDisposable
    interface IAsyncDisposable
type ClientBase<'Channel (requires 'Channel : null)> = class
    interface ICommunicationObject
    interface IDisposable
Public MustInherit Class ClientBase(Of TChannel)
Implements ICommunicationObject
Public MustInherit Class ClientBase(Of TChannel)
Implements IAsyncDisposable, ICommunicationObject, IDisposable
Public MustInherit Class ClientBase(Of TChannel)
Implements ICommunicationObject, IDisposable

型パラメーター

TChannel

サービスへの接続に使用するチャネル。

継承
ClientBase<TChannel>
派生
実装

次のコード例は、ServiceModel メタデータ ユーティリティ ツール (Svcutil.exe)ClientBase<TChannel> クラスを拡張して WCF クライアント クラスを作成する方法を示しています。

public partial class SampleServiceClient : System.ServiceModel.ClientBase<ISampleService>, ISampleService
{

    public SampleServiceClient()
    {
    }

    public SampleServiceClient(string endpointConfigurationName) :
            base(endpointConfigurationName)
    {
    }

    public SampleServiceClient(string endpointConfigurationName, string remoteAddress) :
            base(endpointConfigurationName, remoteAddress)
    {
    }

    public SampleServiceClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) :
            base(endpointConfigurationName, remoteAddress)
    {
    }

    public SampleServiceClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) :
            base(binding, remoteAddress)
    {
    }

    public string SampleMethod(string msg)
    {
        return base.Channel.SampleMethod(msg);
    }
}
<System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")> _
Partial Public Class SampleServiceClient
    Inherits System.ServiceModel.ClientBase(Of ISampleService)
    Implements ISampleService

    Public Sub New()
    End Sub

    Public Sub New(ByVal endpointConfigurationName As String)
        MyBase.New(endpointConfigurationName)
    End Sub

    Public Sub New(ByVal endpointConfigurationName As String, ByVal remoteAddress As String)
        MyBase.New(endpointConfigurationName, remoteAddress)
    End Sub

    Public Sub New(ByVal endpointConfigurationName As String, _
                   ByVal remoteAddress As System.ServiceModel.EndpointAddress)
        MyBase.New(endpointConfigurationName, remoteAddress)
    End Sub

    Public Sub New(ByVal binding As System.ServiceModel.Channels.Binding, _
                   ByVal remoteAddress As System.ServiceModel.EndpointAddress)
        MyBase.New(binding, remoteAddress)
    End Sub

    Public Function SampleMethod(ByVal msg As String) As String Implements ISampleService.SampleMethod
        Return MyBase.Channel.SampleMethod(msg)
    End Function
End Class

注釈

ClientBase<TChannel> クラスを拡張して、サービスへの接続に使用できるカスタム WCF クライアント オブジェクトを作成します。 通常、WCF クライアントの基本クラスは、ServiceModel メタデータ ユーティリティ ツール (Svcutil.exe) などのツールによってユーザーに代わって拡張されます。 例については、「例」セクションを参照してください。

ClientBase<TChannel> クラスは、インターフェイスと System.ServiceModel.ChannelFactory<TChannel> クラスの使用よりもオブジェクトを優先する開発者が迅速かつ簡単に使用できます。 いずれの場合も、このクラスは、System.ServiceModel.ChannelFactory<TChannel> クラスと System.ServiceModel.IClientChannel インターフェイスのメソッドと機能をラップまたは公開します。

System.ServiceModel.ServiceHost クラスを使用する場合と同様に、呼び出しを行ったり、Openを呼び出したりする前に、クラスを作成し、エンドポイント、チャネル ファクトリ、またはセキュリティ情報を変更できます。 詳細については、「WCF クライアント使用した WCF クライアントの概要の とサービスへのアクセスの 」を参照してください。

このクラスから派生するマネージド C++ ユーザーの特別な注意:

  • デストラクターではなく、クリーンアップ コードを (On)(Begin)Close (または OnAbort) に配置します。

  • デストラクターを使用しないでください。これにより、コンパイラは IDisposableを自動生成します。

  • 参照以外のメンバーは避けてください。コンパイラが IDisposableを自動生成する可能性があります。

  • ファイナライザーを使用しないでください。ただし、ビルド警告を含める場合は、ビルド警告を抑制し、SuppressFinalize(Object) とファイナライザー自体を (On)(Begin)Close (または OnAbort) から呼び出して、自動生成された IDisposable 動作をエミュレートする必要があります。

コンストラクター

ClientBase<TChannel>()

アプリケーション構成ファイルの既定のターゲット エンドポイントを使用して、ClientBase<TChannel> クラスの新しいインスタンスを初期化します。

ClientBase<TChannel>(Binding, EndpointAddress)

指定したバインディングとターゲット アドレスを使用して、ClientBase<TChannel> クラスの新しいインスタンスを初期化します。

ClientBase<TChannel>(InstanceContext)

双方向の会話のコールバック オブジェクトとして callbackInstance を使用して、ClientBase<TChannel> クラスの新しいインスタンスを初期化します。

ClientBase<TChannel>(InstanceContext, Binding, EndpointAddress)

ClientBase<TChannel> クラスの新しいインスタンスを初期化します。

ClientBase<TChannel>(InstanceContext, ServiceEndpoint)

指定した InstanceContext オブジェクトと ServiceEndpoint オブジェクトを使用して、ClientBase<TChannel> クラスの新しいインスタンスを初期化します。

ClientBase<TChannel>(InstanceContext, String)

指定したコールバック サービスとエンドポイント構成情報を使用して、ClientBase<TChannel> クラスの新しいインスタンスを初期化します。

ClientBase<TChannel>(InstanceContext, String, EndpointAddress)

ClientBase<TChannel> クラスの新しいインスタンスを初期化します。

ClientBase<TChannel>(InstanceContext, String, String)

ClientBase<TChannel> クラスの新しいインスタンスを初期化します。

ClientBase<TChannel>(ServiceEndpoint)

指定した ServiceEndpointを使用して、ClientBase<TChannel> クラスの新しいインスタンスを初期化します。

ClientBase<TChannel>(String)

endpointConfigurationNameによってアプリケーション構成ファイルで指定された構成情報を使用して、ClientBase<TChannel> クラスの新しいインスタンスを初期化します。

ClientBase<TChannel>(String, EndpointAddress)

指定したターゲット アドレスとエンドポイント情報を使用して、ClientBase<TChannel> クラスの新しいインスタンスを初期化します。

ClientBase<TChannel>(String, String)

ClientBase<TChannel> クラスの新しいインスタンスを初期化します。

プロパティ

CacheSetting

キャッシュ設定を取得または設定します。

Channel

さまざまな構成済みのサービス エンドポイントにメッセージを送信するために使用される内部チャネルを取得します。

ChannelFactory

基になる ChannelFactory<TChannel> オブジェクトを取得します。

ClientCredentials

操作の呼び出しに使用されるクライアント資格情報を取得します。

Endpoint

WCF クライアントが接続できるサービスのターゲット エンドポイントを取得します。

InnerChannel

基になる IClientChannel 実装を取得します。

State

ClientBase<TChannel> オブジェクトの現在の状態を取得します。

メソッド

Abort()

ClientBase<TChannel> オブジェクトを現在の状態から閉じた状態に直ちに遷移させます。

Close()

ClientBase<TChannel> オブジェクトを現在の状態から閉じた状態に遷移させます。

CloseAsync()

サービスを呼び出すことができる Windows Communication Foundation (WCF) クライアント オブジェクトの作成に使用される基本実装を提供します。

CreateChannel()

サービスに新しいチャネルを返します。

DisplayInitializationUI()

チャネルを使用する前に初期化する必要がある場合は、ユーザー インターフェイスを表示するように内部チャネルに指示します。

Equals(Object)

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

(継承元 Object)
GetDefaultValueForInitialization<T>()

C# の既定のキーワードの動作をレプリケートします。

GetHashCode()

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

(継承元 Object)
GetType()

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

(継承元 Object)
InvokeAsync(ClientBase<TChannel>.BeginOperationDelegate, Object[], ClientBase<TChannel>.EndOperationDelegate, SendOrPostCallback, Object)

イベント ベースの非同期パターンを実装するためのサポートを提供します。 このパターンの詳細については、「イベント ベースの非同期パターンの概要」を参照してください。

MemberwiseClone()

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

(継承元 Object)
Open()

ClientBase<TChannel> オブジェクトが作成された状態から開かれた状態に遷移します。

OpenAsync()

サービスを呼び出すことができる Windows Communication Foundation (WCF) クライアント オブジェクトの作成に使用される基本実装を提供します。

ToString()

現在のオブジェクトを表す文字列を返します。

(継承元 Object)

明示的なインターフェイスの実装

IAsyncDisposable.DisposeAsync()

サービスを呼び出すことができる Windows Communication Foundation (WCF) クライアント オブジェクトの作成に使用される基本実装を提供します。

ICommunicationObject.BeginClose(AsyncCallback, Object)

ClientBase<TChannel>を閉じる非同期操作を開始します。

ICommunicationObject.BeginClose(TimeSpan, AsyncCallback, Object)

指定したタイムアウトで ClientBase<TChannel> を閉じる非同期操作を開始します。

ICommunicationObject.BeginOpen(AsyncCallback, Object)

ClientBase<TChannel> オブジェクトを開く非同期操作を開始します。

ICommunicationObject.BeginOpen(TimeSpan, AsyncCallback, Object)

指定した時間内に ClientBase<TChannel> オブジェクトを開く非同期操作を開始します。

ICommunicationObject.Close()

通信オブジェクトを現在の状態から閉じた状態に遷移させます。

ICommunicationObject.Close(TimeSpan)

ClientBase<TChannel> オブジェクトを現在の状態から閉じた状態に遷移させます。

ICommunicationObject.Closed

ClientBase<TChannel> オブジェクトが現在の状態から閉じた状態に遷移したときに呼び出されるイベント ハンドラー。

ICommunicationObject.Closing

ClientBase<TChannel> オブジェクトが現在の状態から閉じた状態に遷移したときに呼び出されるイベント ハンドラー。

ICommunicationObject.EndClose(IAsyncResult)

ClientBase<TChannel> オブジェクトを閉じる非同期操作を完了します。

ICommunicationObject.EndOpen(IAsyncResult)

ClientBase<TChannel> オブジェクトを開く非同期操作を完了します。

ICommunicationObject.Faulted

ClientBase<TChannel> オブジェクトに対する操作の実行中にエラーが発生したときに呼び出されるイベント ハンドラー。

ICommunicationObject.Open()

通信オブジェクトが作成された状態から開かれた状態に遷移します。

ICommunicationObject.Open(TimeSpan)

指定した時間内に、ClientBase<TChannel> オブジェクトが作成された状態から開かれた状態に遷移します。

ICommunicationObject.Opened

ClientBase<TChannel> オブジェクトが作成された状態から開かれた状態に遷移したときに呼び出されるイベント ハンドラー。

ICommunicationObject.Opening

ClientBase<TChannel> オブジェクトが作成された状態から開かれた状態に遷移したときに呼び出されるイベント ハンドラー。

IDisposable.Dispose()

Dispose() メソッドの明示的な実装。

拡張メソッド

CloseHelperAsync(ICommunicationObject, TimeSpan)

サービスを呼び出すことができる Windows Communication Foundation (WCF) クライアント オブジェクトの作成に使用される基本実装を提供します。

OpenHelperAsync(ICommunicationObject, TimeSpan)

サービスを呼び出すことができる Windows Communication Foundation (WCF) クライアント オブジェクトの作成に使用される基本実装を提供します。

ConfigureAwait(IAsyncDisposable, Boolean)

非同期破棄から返されるタスクの待機を実行する方法を構成します。

適用対象