none
ReportViewer and Entity Framework RRS feed

  • Question

  • Hi,

    I'm developing an application using Entity Framework and now I want to start making reports using ReportViewer component.
    What would be the best approach: 
    1. To use existing entity model objects as an Object DataSource
    2. To create a separate DataSet and use it as a DataSource in the report

    What would be the recommended approach?
    Sunday, November 22, 2009 12:20 AM

Answers

  • Well... I tried different approaches and decided to create a new class layer for reporting purposes only. I have one class per report and all calculations, aggregations, lookups and who knows what else, is done inside the class using linq to entities. The reporting class exposes only properties relevant to the report being generated from it.
    There is a base class for these reporting classes to inherit from. The base class contains common properties like company name and current username, which are used in most of the reports.

    I don't know if this is the recommended approach, but it turns out to be the most flexible one, at least in my case.
    • Marked as answer by Anil Mujagic Sunday, November 22, 2009 10:44 PM
    Sunday, November 22, 2009 10:44 PM

All replies

  • Well... I tried different approaches and decided to create a new class layer for reporting purposes only. I have one class per report and all calculations, aggregations, lookups and who knows what else, is done inside the class using linq to entities. The reporting class exposes only properties relevant to the report being generated from it.
    There is a base class for these reporting classes to inherit from. The base class contains common properties like company name and current username, which are used in most of the reports.

    I don't know if this is the recommended approach, but it turns out to be the most flexible one, at least in my case.
    • Marked as answer by Anil Mujagic Sunday, November 22, 2009 10:44 PM
    Sunday, November 22, 2009 10:44 PM
  • Anil can you send some sample snippet to naijacoder@hotmail.com
    Thanks

    Monday, December 6, 2010 11:11 PM
  • Thanks Anil.  I'm going to try this.
    Tuesday, December 7, 2010 2:35 PM
  • Can you Post your Approach.  Im trying to figure out how to use Associations in my EF Model.  For example:

    =Fields!Address.Value.City

    • Proposed as answer by Frank Serrato Wednesday, July 18, 2012 8:33 PM
    Friday, January 14, 2011 3:16 PM