Monday, March 19, 2012

Add to SSRS data extension with config file

Hello,

I try to add an data extension who take the information to connect to the database in a config file. But It's could not retreive the values corresponding to the key.

I'm using the class ConfigurationManager from the namespace System.Configuration.

ConfigurationManager.AppSettings["QueryModel"]

Without the config file, the extension is working well.... I got the impression that reporting service and Visual Studio BI don't find the config file.

If someone can help me or have some advices. I will be pleased

Hi,

Finally, I found how to manage data Extension with config file.

The solution is :

It's not possible to do exactily like a simple application, add a configuration file app.config don't work with extension.

I found a part of the answer on this forum. it's was talking about IExtension.SetConfiguration.

In fact to solve this problem, we need to add a tags in the RSReportDesigner.config file( PrivateAssemblies Directory of Visual Studio 8) or in the RSReportServer.config ( Report Server Directory), just after the definition of the extension

Code Snippet

<Extension Name="My Extension" Type="Microsoft.Samples.ReportingServices.MyExtension.ExtensionClass,Microsoft.Samples.ReportingServices.MyExtension">
<Configuration>
<MyExtensionConfigurationData>
<MyExtensionData1>Value</MyExtensionData1>
<MyExtensionData2>Value</MyExtensionData2>
</MyExtensionConfigurationData>
</Configuration>

</Extension>

You need to implemente the SetConfiuration Method inside your class who implement the IExtension Interface.

Code Snippet

public void SetConfiguration(string configuration)

{

configXML = configuration;

}

the content of the string "configXML" while be the block corresponding to the <MyExtensionConfigurationData> tag

Next, you have to add a fonction to parse the XML block and put it inside a List or a Map...

Bye

No comments:

Post a Comment