ReportViewer - ReportParameter - WinForms vs WebForms namespace
I have a web app and a winforms app - both of them display reports via the standard web/winforms ReportViewer controls. (Using VS2010 / .Net 4.0 btw).
开发者_运维技巧I also have a shared library that returns the ReportParameter objects for the reports being generated. I ran into little issue with the ReportParameter's being returned though:
The Winforms ReportViewer uses ReportParameter from Microsoft.Reporting.WinForms namespace. The WebForms ReportViewer uses ReportParameter from Microsoft.Reporting.WebForms namespace.
Is there a generic ReportParameter class I can use to share reportparameters from web vs winforms? Or is there a built-in utility to easily translate between the two?
I know it is old, but I had the same question today so figured I would provide an answer.
I couldn't find anything definitive, so I pulled out ye-old-reflector... and I chose to use Microsoft.ReportViewer.WebForms because it referenced a subset of the assmblies referenced by Microsoft.ReportViewer.WinForms.
Specifically...
WebForms referenced:
- Microsoft.ReportViewer.Common
- mscorlib
- System
- System.Configuration (Not Referenced by WinForms)
- System.Data
- System.Drawing
- System.Web
- System.Web.Services
- System.XML
WinForms referenced:
- Microsoft.ReportViewer.Common
- mscorlib
- System
- System.Data
- System.Drawing
- System.Web
- System.Web.Services
- System.Windows.Forms (Not referenced by WebForms)
- System.XML
If I am going to be pulling in an assembly reference to System.Web regardless, I might as well avoid the System.Windows.Forms reference impo.
EDIT Also, as for passing around ReportParameter across references, you will pretty much have to re-map them accordingly. Either via wrapper, or some Mapping extension method would do the trick.
精彩评论