[Telerik] 报告集合中的报告元数据
我的网络项目中有一组快速增长的 Telerik 报告。我的数据提供策略是每个报告都有一个包含 SQL 查询的伴随文本文件。我处理复杂的过滤条件,例如长“x is in(y,z,a,b,c...)”,或“((x=1) and (x < y))”,重复一百次有时,通过在使用文本文件查询获取报表的数据表之前对文本文件查询进行文本替换。
所有报告都是从 Telerik.Reporting.Report
派生的类,这些类具有用作报告元数据的有限属性,例如报告的业务标题与报告的编程名称。没有属性字段,例如报表类别、报表的 SQL 查询文件的名称、报表可能的备用查看页面、要为报表禁用的公共过滤器参数的子集等。
我找到第一个这里的候选解决方案没有吸引力,即。在文件、web.config 或数据库表中创建和维护“报告设置”存储。该商店与实际报告脱节,在它们或商店中工作需要频繁且烦人的上下文交换。
我更喜欢的想法是使用类似于动态数据元数据方案的东西,其中实体类上的属性归属于另一个类来保存实体的元数据。我还可以扩展 Telerik.Reporting.Report
,为我想要附加到报告的属性添加一个字典,并从中导出我的所有报告。
任何对我当前想法的批评或对其他选择的建议,我们将不胜感激。
I have a rapidly growing set of Telerik reports in my web project. My data providing strategy is that each report has an companying text file containing a SQL query. I handle complex filter criteria, like long 'x is in(y,z,a,b,c....)', or '((x=1) and (x < y))', repeated a hundred times, by doing text substitutions on a text file query before using it to get a DataTable for the report.
All reports are classes that derive from Telerik.Reporting.Report
, which have limited properties that serve as report meta-data, such as business title of the report, vs. the report's programmatic name. There are no fields for attributes such as a report category, the name of the SQL query file for the report, possible alternate viewing page for the report, the subset of common filter parameters to be disabled for the report, etc.
I find the first candidate solutions here unattractive, viz. creating and maintaining a 'report settings' store, either in a file, web.config, or a database table. This store is divorced from the actual reports, and working in them or the store requires frequent and annoying context swaps.
My more favoured idea is to use something similar to the Dynamic Data meta-data scheme, where an attribute on the entity class ascribes another class to hold meta-data for the entity. I could also extend Telerik.Reporting.Report
, adding maybe a dictionary for attributes I want to attach to reports, and derive all my reports from that.
Any criticism on my current thinking, or suggestions on other options, will be appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
由于 Telerik Report 定义只不过是纯 C# / VB 类,因此您应该能够使用任何“标准”C# 方法在报告中包含元数据。在派生的报表类中,您可以添加管理设置所需的任何字段或属性,或者您可以尝试通过在项目中扩展
Report
来创建更“优雅”的解决方案。当前版本的 Telerik Reporting 并未提供用于设置报告属性的本机元数据解决方案,但这是一个非常有趣的想法。我已要求 Telerik Reporting 团队权衡这个想法,因此他们应该尽快提供更多指导。
同时,我认为您计划的“报告基类”走在正确的轨道上,这将使所有项目报告可以轻松设置必要的“设置”值。
Since Telerik Report definitions are nothing more than pure C# / VB classes, you should be able to use any "standard" C# approach for including meta data with your reports. In your derived report classes, you can add any fields or proprieties you need to manage your settings, or you can try to create a more "elegant" solution by extending
Report
in your project.The current version of Telerik Reporting does not offer a native metadata solution for setting report attributes, but it is a very interesting idea. I have asked the Telerik Reporting team to weigh-in on this idea, so they should provide more guidance soon.
In the mean time, I think you are on the right track with your planned "Report base class" that will make it easy for all project reports to set the necessary "settings" values.