thomas thomas - 2 months ago 19
C# Question

SSRS Custom Assembly - Pass Parameters to Constructor

When the SSRS system automatically creates an instance of a class contained in a custom assembly, is there a way to pass in parameters to the constructor? Screenshot of my setup is below.

enter image description here

My goal is ultimately to pass parameters to the constructor so that

InstanceOfClass
is initialized with some values.

If it is not possible to do this, is it possible to call another method of the class after the object has been created? Perhaps via the default value of an internal parameter or something, where the internal parameter serves no other purpose other than to allow a function call?

Answer

So in all of my testing I have not been able to pass parameters to the constructor of my custom assembly class. Instead I have taken a different approach and will let the SSRS system create an instance of the class which I will then reference in the Report Variables section of the report properties. In this section I will call an Initialize method I wrote which accepts the parameters I wanted to pass into the constructor.

enter image description here

enter image description here

enter image description here

Once I do this I can then reference Code.EMMASecurity.[Method] and use information which was previously stored as instance variables by the call to Initialize.

enter image description here