Using Entity Framework

Before you start, please, download and install the latest Entity Framework version.

Let’s use an existing AdventureWorks Sample database, which is available here

Generate DataModel from the existing AdventureWorks database.

Put reportManager component. Let's call it reportManager1.

In the codebehind write the following:

AdventureWorksEntities class was automatically generated and we need to pass these entities as the datasource to the report.

In order to add the entity framework datasource we need to add the following code after InitializeComponent call:

AdventureWorksEntities entities = new AdventureWorksEntities();
reportManager1.DataSources.Add("Entity", entities);

After running the application we will have our datasource be available.

Put the databand and specify datasource from our Entity datasource:

Put the textbox in the databand and specify “value” binding for it:

Here is the result of our manipulations:

The only limitation is that we haven’t invented approach for constructing your reports in the Design Time. You may create your template in the runtime Windows Forms Designer and then use this template in the ReportManager in the design time.

Add Feedback