帮助重构旧版自定义报告模块

发布于 2024-09-08 17:21:52 字数 1456 浏览 3 评论 0原文

我有 Intranet win.forms(单击一次)应用程序,带有自定义内置报告模块(40 多个 WinWord 和 Excel 报告)。模块处于分离的组件中并通过接口进行抽象。我们有消息来源并继续支持它。

常见的界面如下:

IReportProvider {
  // introspection stuff 
  IEnumerable<ReportCategoryInfo> GetReportGroups();
  IEnumerable<ReportInfo> GetReports(Guid categoryId);
  ...

  // common function 
  ReportResult CreateReport(Guid reportId, ReportParamCollection prms, ..)
}

ReportInfo描述了基本信息和信息。所需参数。自动生成 UI,让用户选择报告参数。

class ReportInfo {
  public Guid Id { get; set; }
  public string Title { get; set; }
  public List<ReportParameterInfo> Params { get; set; }
  ...
}

ReportResult提供二进制报告表示以及二进制类型(是Word2003、Excel2003等)

class ReportResult {
  public byte[] Document { get; set; }
  public ReportType DocumentType { get; set; }
  public List<string> Warnings { get; set; }
  ...
}

没有身份验证要求,并且必须使用word/excel表示。 PDF 不受欢迎。

问题是 - 每次添加/更正报告时,我们都会更新报告模块并发布新的应用程序版本(因为它们是捆绑在一起的)。

我想:

  • 更新报告时避免使用新的应用程序版本。
  • 我们还必须添加 Intranet Web 界面来进行报告。

我将按以下方式重构当前代码:

  • 将报告功能提取到单独的 WCF 服务中
  • 将报告模板文件(Excel 和 Word 模板)从应用程序中取出,并放入仅报告服务可访问的文件夹中。
  • 新的 WCF 服务将提供自省接口(存在哪些报告以及需要哪些参数)以及检索二进制报告表示形式(word 或 excel)的方法
  • 应该有两个客户端与 WCF 服务通信:当前客户端的 Win.Forms 和 Web 客户端。客户端将提供报告导航UI界面,让用户填写参数并接收返回的报告文件。 Win.Forms 客户端将执行 WinWord 或 Excel 以显示收到的报告。

你对此有何看法?

I have intranet win.forms (click once) application with custom built-in reporting module (40+ WinWord & Excel reports). Module is in separated assembly and abstracted via interfaces. We have sources and continue to support it.

Common interfaces look like:

IReportProvider {
  // introspection stuff 
  IEnumerable<ReportCategoryInfo> GetReportGroups();
  IEnumerable<ReportInfo> GetReports(Guid categoryId);
  ...

  // common function 
  ReportResult CreateReport(Guid reportId, ReportParamCollection prms, ..)
}

ReportInfo describes basic info & parameters required. UI is auto generated to let user choose report parameters.

class ReportInfo {
  public Guid Id { get; set; }
  public string Title { get; set; }
  public List<ReportParameterInfo> Params { get; set; }
  ...
}

and ReportResult provides binary report representation as well as binary type (is it Word2003, Excel2003, e.t.c)

class ReportResult {
  public byte[] Document { get; set; }
  public ReportType DocumentType { get; set; }
  public List<string> Warnings { get; set; }
  ...
}

There is no authentication requirements and word/excel representation is the must. PDF is not welcomed.

Problem is - every time report is added/corrected we update reporting module and publish new application version ('cos they are tied together).

I want to:

  • avoid new application versions when reports are updated.
  • We also have to add intranet web interface to reporting.

I am going to refactor present code the following way:

  • Extract reporting functionality into separate WCF service
  • Put report template files (excel & word templates) out of application and put to folder accessible to reporting service only.
  • New WCF service will provide introspection interfaces (what reports are present and what parameters are required) and method to retrieve binary report representation (word or excel)
  • There should be two clients that communicate with WCF service: Win.Forms for present client and Web one. Client will provide reporting navigation UI-interface to let user fill parameters and receive report file back. Win.Forms client will execute WinWord or Excel to show report received.

What do you think of that?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

笛声青案梦长安 2024-09-15 17:21:52

首先:内网win.forms?您是在谈论 ClickOnce WinForms 应用程序、MSIE 托管的 WinForms 应用程序、带有嵌入式 Web 浏览器的 WinForms 还是更奇特的东西?我将假设您实际上有一个中央数据存储,因为否则您的 Intranet Web 界面将不会出现...

这实际上取决于您的 WCF 服务的接口(或者您选择托管和连接您的 WCF 服务的任何方式)服务逻辑)。你还没有真正描述过它们。需要思考的一些问题:

  1. 它是纯粹基于数据的服务,还是进行一些用户界面处理?后者越多,同时对 Office 和 Web 报告的支持就越差……在一种极端情况下,每个报告必须有两个版本。然后,当您想为移动界面添加单独的 Web 版本时会发生什么?
  2. 您如何将报告与服务分离?相同的服务可以支持多个报告吗?
  3. 数据接口是笨重的还是冗长的?厚重的界面往往可以更好地扩展,但您会因为简单的查询而付出代价(因为您需要传递的数据比大多数报告所需的数据多)。
  4. 您有用户身份验证和授权要求吗?是否有只允许部分用户查看的报告或数据?
  5. WinWord 和 Excel 是必需的还是遗留的?用户是否真的需要可编辑的文档:如果不需要,Web 界面或提供 PDF 文件的服务就足够了吗?一般来说,Office 集成并不总是最容易支持的选项,尤其是当下一个 Office 版本或服务包出现时,或者最终用户开始修改他们的模板...

令我有些担心的是,您让 WCF 服务知道关于甚至处理报告模板文件(模板目录、内省接口)。为什么?让模板仅依赖于数据检索服务不是更干净吗?无论如何,您不会与网络报道有这种关系吗?

First of all: intranet win.forms? Are you talking about a ClickOnce WinForms application, an MSIE hosted WinForms application, a WinForms with an embedded web browser, or something even more exotic? I'm going to assume that you actually have a central data store, since otherwise your intranet web interface won't be happening...

This really depends on the interfaces to your WCF services (or whatever way you choose to host and interface your service logic). You haven't really described them. Some questions to ponder:

  1. Is it a purely data based service, or does it do some user interface processing? The more of the latter, the worse support for Office and web reports simulatenuously... at one extreme, you're going to have to have two versions of each report. And then what happens when you want to add e.g. separate web versions for mobile interfaces?
  2. How well can you decouple reports from services? Can the same services support several reports?
  3. Are the data interfaces chunky or chatty? Chunky interfaces tend to scale better, but you pay the price with simple queries (since you need to pass more data than most reports need).
  4. Do you have user authentication and authorization requirements? Are there reports or data which only some users are allowed to see?
  5. Is WinWord and Excel a requirement or legacy? Do users really need editable documents: if not, would the web interface suffice, or a service providing PDF files? Generally speaking, Office integration isn't always the most easily supported option, especially once the next Office version or service pack hits you, or end users start tinkering with their templates...

What worries me somewhat is that you let the WCF service know about and even handle the report template files (template directory, introspection interfaces). Why? Wouldn't it be cleaner to have the templates depend only on a data retrieval service? Won't you have that relation with the web reports anyway?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文