建立數據處理延伸模組連結庫

您建立的每個 Reporting Services 資料處理延伸模組都應該指派給唯一的命名空間,內建於程式庫或是組件檔中。 命名空間的確切名稱並不重要,但它必須是唯一的,且不會與任何其他延伸模組共用。 Microsoft 為 Reporting Services 隨附的資料處理延伸模組使用命名空間 Microsoft.ReportingServices.DataProcessing。 您應該為公司的資料處理延伸模組建立自己的唯一命名空間。

以下範例示範開始 Reporting Services 資料處理延伸模組的程式碼,這會使用包含資料處理介面與任何公用程式類別的命名空間。

Imports System  
Imports Microsoft.ReportingServices.DataProcessing  
Imports Microsoft.ReportingServices.Interfaces  
  
Namespace CompanyName.ExtensionName  
   ...  
using System;  
using Microsoft.ReportingServices.DataProcessing;  
using Microsoft.ReportingServices.Interfaces;  
  
namespace CompanyName.ExtensionName  
{  
   ...  

編譯 Reporting Services 資料處理延伸模組時,您必須將 Microsoft.ReportingServices.Interfaces.dll 的參考提供給編譯器,因為其包含資料處理延伸模組介面。 需要 Microsoft.ReportingServices.DataProcessing 命名空間實作資料處理延伸模組介面,而且需要 Microsoft.ReportingServices.Interfaces 命名空間實作 IExtension 介面。 例如,如果所有包含實作以 C# 撰寫之 Reporting Services 資料處理延伸模組的程式碼檔案,都在一個目錄中並且副檔名為 .cs,則會從該目錄發出下列命令,編譯儲存在 CompanyName.ExtensionName.dll 中的檔案。

csc /t:library /out:CompanyName.ExtensionName.dll *.cs /r:System.dll /r:Microsoft.ReportingServices.Interfaces.dll  

以下程式碼範例顯示會用於副檔名為 .vb 之 Microsoft Visual Basic 檔案的命令。

vbc /t:library /out:CompanyName.ExtensionName.dll *.vb /r:System.dll /r:Microsoft.ReportingServices.Interfaces.dll  

注意

您也可以使用 Visual Studio 來設計、開發與建置資料處理延伸模組。 如需使用 Visual Studio 開發組件的詳細資訊,請參閱 Visual Studio 文件。