Using Entity Framework Entities as Stimulsoft Report datasource

Stimulsoft Reports.WPF discussion
Post Reply
dozer
Posts: 7
Joined: Tue Jul 26, 2011 2:51 pm
Location: Växjö, Sweden

Using Entity Framework Entities as Stimulsoft Report datasource

Post by dozer »

Hi,

I'm currently investigating the use of Stimulsoft and we're using Entity Framework with Self-Tracking Entities as datasource in our project. So we want to also use this as datasource to our reports. The POCO objects that STE generates is placed in a seperate assembly that is used both on the server and the client of our N-Tier application and is transferred between these using WCF. The client has the responsibility to generate reports based on the data that is retrieved from the server.

Currently, when I'm testing this I have a problem which I can't find any solution and is a showstopper.

I load a report in which I set the datasource to my result (An order with orderlines which has article on each orderline) from the server using RegData (I can't use RegBusinessObject since it doesn't include my navigation properties).

When I try to render the report I get the following message in an exception:
The type or namespace name '' could not be found (are you missing a using directive or an assembly reference?)
So, my question is why? From the error message it seems that the autogenerated report code need to reference my assembly that contains my STE-POCO objects, but I can't find any way to do this. I know that RegBusinessObject works without this, but I can't use this since I need data in the navigation properties of my Order, OrderLine and Article in my report which RegBusinessObject doesn't expose to me.

So, how can I solve this critical problem?

Thanks for any solutions,
--Rune
dozer
Posts: 7
Joined: Tue Jul 26, 2011 2:51 pm
Location: Växjö, Sweden

Using Entity Framework Entities as Stimulsoft Report datasource

Post by dozer »

Well..

I'll answer myself... It's good that Reflector exists which can be a lifesaver (at least timesaver) sometimes.

There is a property on the StiReport class that is named ReferencedAssemblies which has a public getter and setter and returns an array. So, this can be modified by this code:

Code: Select all

List assemblies = new List(report.ReferencedAssemblies);
assemblies.Add(System.Reflection.Assembly.GetAssembly(typeof()).Location);
report.ReferencedAssemblies = assemblies.ToArray();
Which adds the a reference during compiling to the assembly where resides.

--Rune
Andrew
Posts: 4108
Joined: Fri Jun 09, 2006 3:58 am

Using Entity Framework Entities as Stimulsoft Report datasource

Post by Andrew »

Hello,

Do we understand you correct the issue is solved?

Let us know if you need any additional help.
Thank you.
dozer
Posts: 7
Joined: Tue Jul 26, 2011 2:51 pm
Location: Växjö, Sweden

Using Entity Framework Entities as Stimulsoft Report datasource

Post by dozer »

Yes, problem solved :)
Andrew
Posts: 4108
Joined: Fri Jun 09, 2006 3:58 am

Using Entity Framework Entities as Stimulsoft Report datasource

Post by Andrew »

Hello,

Great!

Thank you.
Post Reply