Share via


建立資料處理延伸模組程式庫

每個您建立的 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 文件集。