DataSource from an Assembly

Stimulsoft Reports.WPF discussion
JobaDiniz
Posts: 8
Joined: Wed May 02, 2012 9:46 am

DataSource from an Assembly

Post by JobaDiniz »

I have a class that works as DataAccess layer in my application. It has a method with this signature: IEnumerable List(string filter).
Is it possible to within the report design call this method?

I want that my DataSource comes from an Assembly, specifically from a method.
I don't want to, from code behind, call this List method and set the RegBusinessObject with the returned IEnumerable. I just wan to tell the Stimul where to find the source.

Is it possible?
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

DataSource from an Assembly

Post by HighAley »

Hello.
JobaDiniz wrote:I have a class that works as DataAccess layer in my application. It has a method with this signature: IEnumerable List(string filter).
Is it possible to within the report design call this method?

I want that my DataSource comes from an Assembly, specifically from a method.
I don't want to, from code behind, call this List method and set the RegBusinessObject with the returned IEnumerable. I just wan to tell the Stimul where to find the source.

Is it possible?
We can't imagine what do you want to do.
Could you describe it more detailed?

Thank you.
JobaDiniz
Posts: 8
Joined: Wed May 02, 2012 9:46 am

DataSource from an Assembly

Post by JobaDiniz »

Inside Stimul, can I add a DataSource from assembly, and within that assembly choose which method to call specifying its parameters?
The only thing I want to do in code is:

Code: Select all

StiReport report = new StiReport();
report.Load(path);
report.ShowWithWpf();
All my settings regarding the DataSource and parameter have to be inside StimulReport itself.
Can it be done?
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

DataSource from an Assembly

Post by HighAley »

Hello.
JobaDiniz wrote:Inside Stimul, can I add a DataSource from assembly, and within that assembly choose which method to call specifying its parameters?
The only thing I want to do in code is:

Code: Select all

StiReport report = new StiReport();
report.Load(path);
report.ShowWithWpf();
All my settings regarding the DataSource and parameter have to be inside StimulReport itself.
Can it be done?
You should use RegBusinessObject() method to register your Business Object before showing it.

Thank you.
JobaDiniz
Posts: 8
Joined: Wed May 02, 2012 9:46 am

DataSource from an Assembly

Post by JobaDiniz »

That's the whole point: I don't want to call this method to register my Business Objects.
I want to tell the Stimul where to find my Business Objects when it is rendering.

Example: inside MyAssembly.dll exists a class MyClass, and inside it exists a method IEnumerable MyMethod(string parameters).

So, Stimul: this is the assembly you'll be using, this is the class within that assembly, this is the method of the class and those are the parameters you'll need. They are all there, so when it is needed use them to render the report.

I can't be more clear than that.
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

DataSource from an Assembly

Post by HighAley »

Hello.
JobaDiniz wrote:That's the whole point: I don't want to call this method to register my Business Objects.
I want to tell the Stimul where to find my Business Objects when it is rendering.

Example: inside MyAssembly.dll exists a class MyClass, and inside it exists a method IEnumerable MyMethod(string parameters).

So, Stimul: this is the assembly you'll be using, this is the class within that assembly, this is the method of the class and those are the parameters you'll need. They are all there, so when it is needed use them to render the report.

I can't be more clear than that.
Please, send us your assembly with Business Object and information how to create the report for analysis.

Thank you.
JobaDiniz
Posts: 8
Joined: Wed May 02, 2012 9:46 am

DataSource from an Assembly

Post by JobaDiniz »

Similar to these links:

http://www.thescarms.com/dotnet/DLLDatasource.aspx (Crystal Reports)
http://support.microsoft.com/kb/920769 (Reporting Services)

They invoke a specified method to get the data.
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

DataSource from an Assembly

Post by HighAley »

Hello.

We couldn't help you without library with Business Objects that you use.

We could show you code how to connect xml data in the report. You should write this code at the design time in the code tab.

Code: Select all

public Report()
        {
            this.InitializeComponent();

            DataSet ds = new DataSet();
            ds.ReadXml("d:\\Demo.xml");

            Categories.DataTable = ds.Tables["Categories"];
        }
Other way you should use RegBusinessObject() method.

Thank you.
denis.bredikhin
Posts: 4
Joined: Mon Jan 23, 2012 11:39 am
Location: Belgium

DataSource from an Assembly

Post by denis.bredikhin »

In our project we had almost the same problem. And it was solved with custom data provider. But it was not very easy...
But now we actually can run any code as data source. We even can run method inside the report as data source!

You need to create your own class, derived from StiSqlAdapterService, and override method ConnectDataSourceToData (and may be some other methods).

If you are interested, I can post some parts of code here.
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

DataSource from an Assembly

Post by HighAley »

Hello.
denis.bredikhin wrote:In our project we had almost the same problem. And it was solved with custom data provider. But it was not very easy...
But now we actually can run any code as data source. We even can run method inside the report as data source!

You need to create your own class, derived from StiSqlAdapterService, and override method ConnectDataSourceToData (and may be some other methods).

If you are interested, I can post some parts of code here.
OK. It will be useful to see your code.

Thank you.
Post Reply