Databases Reference
In-Depth Information
Creating a Custom Data Processing
Extension
Creating a full-blown data provider is no trivial task. The goal of this walk-through is to familiarize you
with the .NET data access mechanism, as well as help you create and install a custom Reporting Services
data processing extension. Our implementation is simplified in that it does not support transactions or
the use of parameters, and many of the methods are empty unless code is explicitly required. All of the
images shown were created using the Visual Basic IDE. The code snippets will be given in both lan-
guages unless there is a reason to do otherwise.
The Scenario
After the release of Reporting Services for SQL 2000 and the first edition of this topic, it seemed that
everywhere that I went, I was asked the same question: Why doesn't Reporting Services allow me to
consume existing DataSet objects? Alas, I had no answer.
It seems that a lot of companies have internal data silos. (Really?) Well, the complaint was that after
going to the trouble of getting different internal organizations to expose needed data via Web services,
you were unable to easily use it in a report.
After the release of Service Pack 1, the Books Online documentation contained an example extension
that used some of the dataset's intrinsic properties to allow you to query a DataSet object and limit the
resulting rows based upon certain criteria. The only problem was that you were unable to do complex
filtering or limit the columns returned by a query. This example demonstrates one way that you might
give yourself the filtering and sorting that you need.
Creating and Setting Up the Project
Let's start by creating our project. Create the Project by choosing File
Project. Change the name
of the Project to DataSetDataExtension . Use the Class Library template. After your project is created,
you need to set up your environment to help you work. The Visual Basic IDE tends to hide some things
from you, so you are going to make some changes to help our C# brethren following along. The first
thing you want to do is show all of your references. The default behavior of VB.NET is to hide them.
Choose Project
New
Show All Files from the menu. The Explorer tab should now show you all of your
project references.
Next, you need to add the references to the required SSRS dll s. The Microsoft.ReportingServices
.DataProcessing namespace is needed to implement the data processing extension interfaces, and the
Microsoft.ReportingServices.Interfaces namespace is needed to implement the IExtension
interface. Both of these namespaces are defined in the same dll , Microsoft.ReportingServices
.Interfaces.dll . The location of extensions and their dependencies is a subdirectory below the
installation directory of SQL Server itself. I will refer to the SQL Server installation path as InstallPath . The
directory for the SSRS extensions dll that you need is InstallPath \MSSQL.3\Reporting Services\
ReportServer\bin . On my machine this directory is C:\Program Files\Microsoft SQL Server\
MSSQL.3\Reporting Services\ReportServer\bin. Choose Project
Properties from the menu.
Browse to the appropriate directory and add the reference. Your Solution Explorer window should now
look something like that shown in Figure 13-4.
Search WWH ::




Custom Search