How to register custom data provider in C#

2019-07-28 04:39发布

问题:

We have Middle tier that provide data. We are trying to write a custom data provider. I have overriden the intefaces of SYstem.Data namespace like IDbCommand, IdbConnection and generated dlls.

We wanted to register the dll.So, that it should be listed in Data Source type window of ssrs.

We are not able to register it. Can anyone help?

回答1:

Development Setup

On your development machine, the DLL for your Data Extension needs to be installed in the Visual Studio directory. This will be something like:

C:\Program Files (x86)\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies

In this same folder you need to add the Data Extension to RSReportDesigner.config as follows: In the <Extensions> <Data> section, add the following line:

<Extension Name="MyDataExtension" Type="My.Name.Space.MyDataExtensionClass"/>

In the <Extensions> <Designer> section, add the following line:

<Extension Name="MyDataExtension" Type="Microsoft.ReportingServices.QueryDesigners.VDTQueryDesigner,Microsoft.ReportingServices.QueryDesigners"/>

You probably also need to add Full Trust for your data extension to function properly. Edit RSPreviewPolicy.config and add the following code security group:

<CodeGroup class="UnionCodeGroup"
    version="1"
    PermissionSetName="FullTrust"
    Name="MyDataExtensionCodeGroup"
    Description="Code group for my data processing extension">
    <IMembershipCondition class="UrlMembershipCondition"
        version="1"
        Url="C:\Program Files (x86)\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies\MyDataExtension.dll"
    />
</CodeGroup>

Now you can use your data processing extension in Visual Studio.

Server Setup

On The Reporting Services server, the Data Extension DLL needs to be installed in the SQL Server Reporting Services directory. This will be something like:

C:\Program Files\Microsoft SQL Server\MSSQL.1\Reporting Services\ReportServer\bin

In the main ReportServer directory above the bin directory you need to add the Data Extension to RSReportServer.config. In the <Extensions> <Data> section, add the following line:

<Extension Name="MyDataExtension" Type="My.Name.Space.MyDataExtensionClass"/>

To give the DLL full trust, edit RSSrvPolicy.config and add the following code security group:

<CodeGroup class="UnionCodeGroup" 
    version="1"
    PermissionSetName="FullTrust"
    Name="MyDataExtensionCodeGroup"
    Description="Code group for my data processing extension">
    <IMembershipCondition class="UrlMembershipCondition"
        version="1"
        Url="C:\Program Files\Microsoft SQL Server\MSSQL.1\Reporting Services\ReportServer\bin\MyDataExtension.dll"
    />
</CodeGroup>