开发者

ReportViewer - ReportParameter - WinForms vs WebForms namespace

开发者 https://www.devze.com 2023-01-26 14:39 出处:网络
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 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号