私は Reporting Services と Sharepoint を使用しています。レポート サービスを利用するアプリケーションを持っていますが、クライアントは私たちのアプリケーションを SharePoint に統合したいと考えています。現在、操作を実行するためのさまざまなメソッドを公開する ReportService.asmx Web サービスに密接に結合されています。Reporting Services には「Sharepoint 統合モード」と呼ばれるものがあり、有効にすると、レポート サーバーの動作が異なり、Sharepoint を使用してレポートを管理します。Sharepoint は、ほぼ同じ ReportService2006.asm という新しい Web サービスを追加します。
ここで、アプリケーションは ReportService への Web 参照を使用し、サービスによって公開されるさまざまなオブジェクトを使用します。ReportService2006 にはまったく同じオブジェクトがありますが、それらは明らかに異なる名前空間にあります。たとえば、2 つの Web 参照があります。各サービスに 1 つずつあり、オブジェクト MyApplication.ReportService.CatalogItem と別の MyApplication.ReportService2006.CatalogItem があります。
依存性注入を使用して、サービスをアプリケーションから抽象化し、ファクトリ パターンと組み合わせて、インターフェイスのどの実装をインスタンス化するかを決定しようとしました。これが私のインターフェースです。このアプリケーションに必要な呼び出しのみを含めるように簡略化しました。
using System;
using NetworkUserEncrypt.ReportService;
namespace MyApplication.Service
{
public interface IReportingService
{
CatalogItem CreateDataSource(string DataSource, string Parent, bool Overwrite, DataSourceDefinition Definition, Property[] Properties);
void DeleteItem(string Item);
DataSourceDefinition GetDataSourceContents(string DataSource);
byte[] GetReportDefinition(string Report);
CatalogItem[] ListChildren(string Item);
}
}
したがって、それぞれが異なる Web サービスをインスタンス化する 2 つの実装があります。
namespace MyApp.Service.Implementation
{
class ReportingServiceImpl : IReportingService
{
ReportingService _service = null;
public ReportingServiceImpl()
{
ReportingService _service = new ReportingService();
}
/* SNIP */
}
}
と
namespace MyApp.Service.Implementation
{
class ReportingService2006Impl : IReportingService
{
ReportingService2006 _service = null;
public ReportingService2006Impl()
{
ReportingService2006 _service = new ReportingService2006();
}
/* SNIP */
}
}
したがって、これらを実行時に ServiceWrapper に挿入できるようにする計画です。ただし、インターフェイスが ReportService に関連付けられており、一部のメソッドが Web 参照 (CatalogItem など) からのオブジェクトを返すことに気付いた場合。したがって、ReportService2006 の実装が別の名前空間から CatalogItem を参照しているため、私のプロジェクトはビルドされません。
何か案は?私はこれで完全に間違った方向に進んでいますか?