完了までの時間: 30 分
この手順では、 EchoAdapterBindingElement クラスと EchoAdapterBindingElementExtensionElement クラスを 更新して、アダプターと接続プロパティにカテゴリを割り当てます。 これにより、プロパティは、アダプター サービス参照プラグインの追加およびアダプター サービス アドインの使用ツールのカテゴリ別に論理的にグループ化されます。 たとえば、次に示すように、 アプリケーション、 EnableAuthentication、および ホスト名 の各プロパティを 接続 カテゴリの下に表示する場合は、アプリケーション、EnableAuthentication、およびホスト名の各プロパティに接続カテゴリを割り当てる必要があります。
同様に、次に示すように InboundFileFilter プロパティと InboundFleSystemWatcherFolder プロパティを Inbound カテゴリの下に表示する場合は、受信カテゴリをそれぞれに割り当てる必要があります。 [その他] カテゴリの下に Count と EnableConnectionPooling を表示する場合は、その他のカテゴリをそれぞれに割り当てる必要があります。
選択したカテゴリ名を持つプロパティを割り当てることができることに注意してください。 この例では、EnableConnnectionPooling プロパティは他のカテゴリに属していないため、その他 (その他) として分類します。 InboundFileFilter プロパティに関して、このプロパティは例内の受信処理中に使用されるため、その他ではなく、プロパティに Inbound を割り当てる方が適切です。 エコー アダプターの完全なカスタム プロパティ分類を次に示します。
財産 | カテゴリ |
---|---|
インバウンドファイルフィルター | インバウンド |
InboundFileSystemWatcherFolder | インバウンド |
数える | その他 |
接続プーリングを有効にする (EnableConnectionPooling) | その他 |
アプリケーション | 接続 |
認証を有効にする | 接続 |
ホスト名 | 接続 |
EchoInUpperCase | フォーマット |
これらの変更に加えて、 EchoAdapterHandlerBase の Dispose メソッドも変更します。
エコー アダプターによって公開されるアダプターのプロパティについては、「 チュートリアル 1: エコー アダプターの開発」の「アダプターのプロパティ」セクションを参照してください。
[前提条件]
この手順を開始する前に、「 手順 1: WCF LOB アダプター開発ウィザードを使用してエコー アダプター プロジェクトを作成する」を完了する必要があります。 また、 System.ServiceModel.Configuration.BindingElementExtensionElement
クラスと System.ServiceModel.Configuration.StandardBindingElement
クラスについても理解している必要があります。
EchoAdapterHandlerBase Dispose メソッドを更新する
ソリューション エクスプローラーで、EchoAdapterHandlerBase.cs ファイルをダブルクリックします。
Dispose メソッドから次のステートメントを削除します。
throw new NotImplementedException("The method or operation is not implemented.");
変更後のメソッドは次のようになります。
protected virtual void Dispose(bool disposing) { // //TODO: Implement Dispose. Override this method in respective Handler classes // }
Adapter プロパティ クラスを更新する
ソリューション エクスプローラーで、EchoAdapterBindingElement.cs ファイルをダブルクリックします。
Visual Studio エディターで、 カスタム生成プロパティ 領域を展開します。
その他のカテゴリを Count プロパティに割り当てるには、Count 実装の先頭に次の 1 つのステートメントを追加します。
[System.ComponentModel.Category("")]
Count 実装は、次と一致する必要があります。
[System.ComponentModel.Category("")] [System.Configuration.ConfigurationProperty("count", DefaultValue = 5)] public int Count { get { return ((int)(base["Count"])); } set { base["Count"] = value; } }
その他のカテゴリを EnableConnectionPooling プロパティに割り当てるには、EnableConnectionPooling 実装の先頭に次の単一ステートメントを追加します。
[System.ComponentModel.Category("")]
Inbound カテゴリを InboundFileFilter プロパティに割り当てるには、InboundFileFilter 実装の先頭に次の単一ステートメントを追加します。
[System.ComponentModel.Category("Inbound")]
Inbound categoryto inboundFleSystemWatcherFolder プロパティを割り当てるには、inboundFleSystemWatcherFolder 実装の先頭に次の単一ステートメントを追加します。
[System.ComponentModel.Category("Inbound")]
カスタム生成プロパティ領域のコードが次のコードと一致することを確認します。
[System.ComponentModel.Category("")] [System.Configuration.ConfigurationProperty("count", DefaultValue = 5)] public int Count { get { return ((int)(base["Count"])); } set { base["Count"] = value; } } [System.ComponentModel.Category("")] [System.Configuration.ConfigurationProperty("enableConnectionPooling", DefaultValue = true)] public bool EnableConnectionPooling { get { return ((bool)(base["EnableConnectionPooling"])); } set { base["EnableConnectionPooling"] = value; } } [System.ComponentModel.Category("Inbound")] [System.Configuration.ConfigurationProperty("inboundFileFilter", DefaultValue = "*.txt")] public string InboundFileFilter { get { return ((string)(base["InboundFileFilter"])); } set { base["InboundFileFilter"] = value; } } [System.ComponentModel.Category("Inbound")] [System.Configuration.ConfigurationProperty("inboundFileSystemWatcherFolder", DefaultValue = "{InboundFileSystemWatcherFolder}")] public string InboundFileSystemWatcherFolder { get { return ((string)(base["InboundFileSystemWatcherFolder"])); } set { base["InboundFileSystemWatcherFolder"] = value; } } #endregion Custom Generated Properties
接続プロパティを更新する
ソリューション エクスプローラーで、EchoAdapterConnectionUri.cs ファイルをダブルクリックします。
Visual Studio エディターで、 カスタム生成プロパティ 領域を展開します。
EchoInUpperCase プロパティに Format カテゴリを割り当てるには、EchoInUpperCase 実装の先頭に次の単一ステートメントを追加します。
[System.ComponentModel.Category("Format")]
接続カテゴリを Hostname プロパティに割り当てるには、ホスト名の実装の先頭に次の 1 つのステートメントを追加します。
[System.ComponentModel.Category("Connection")]
Connection カテゴリを Application プロパティに割り当てるには、アプリケーション実装の先頭に次の単一ステートメントを追加します。
[System.ComponentModel.Category("Connection")]
接続カテゴリを EnableAuthentication プロパティに割り当てるには、EnableAuthentication 実装の先頭に次の単一ステートメントを追加します。
[System.ComponentModel.Category("Connection")]
カスタム生成プロパティ領域のコードが次のコードと一致することを確認します。
#region Custom Generated Properties [System.ComponentModel.Category("Format")] public bool EchoInUpperCase { get { return this.echoInUpperCase; } set { this.echoInUpperCase = value; } } [System.ComponentModel.Category("Connection")] public string Hostname { get { return this.hostname; } set { this.hostname = value; } } [System.ComponentModel.Category("Connection")] public string Application { get { return this.application; } set { this.application = value; } } [System.ComponentModel.Category("Connection")] public bool EnableAuthentication { get { return this.enableAuthentication; } set { this.enableAuthentication = value; } } #endregion Custom Generated Properties
Visual Studio の [ ファイル ] メニューの [ すべて保存] をクリックします。
注
作業を保存しました。 この時点で Visual Studio を安全に閉じるか、次の手順「 手順 3: エコー アダプターの接続を実装する」に進むことができます。
私は何をしましたか?
クラスを更新して、各アダプターにカテゴリを割り当て、エコー アダプターによって公開される接続プロパティを更新しました。
次のステップ
接続、メタデータの参照、検索、解決機能、および送信メッセージ交換を実装します。 最後に、エコー アダプターをビルドして展開します。