仅在报告中使用的存储库模式?
我正在创建一个 MVC 应用程序,我将在其中创建很多基于 RDLC 的报告。查看网络上的一些示例,使用报告数据源的最佳方法似乎是通过存储库。
我的应用程序必须使用多个数据库。我已经使用该模式通过 POCO 对象读取/写入数据库。
1) 我不会扩展域项目中当前的存储库类,而是将单独的存储库类添加到仅处理报告需求的 Web 项目中。
2) 使用存储库模式仅返回可以在报告中使用的不同 IQueryable/IEnumerable 结果集是否有意义?或者这会是存储库模式的错误使用吗?
我真的很想听听您对如何处理上述问题的看法。
谢谢
I am creating an MVC application where I'm going to be creating quite a few RDLC based reports. Looking at some of the examples out there on the web, it seems like the best way to use the report data source is through a repository.
My application will have to work with several databases. I already use the pattern to read/write to the database through POCO objects.
1) Rather than extend my current repository classes which are in my domain project, I was going to add separate repository classes to my Web project that deals only with the reports requirements.
2) Would it make sense to use the Repository pattern to only return different IQueryable/IEnumerable result sets that I could then use within my reports? Or would this be the wrong use of the REpository pattern?
I'd really like to hear your views on how you would go about with the above.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
最好对报告使用查询,因为您只需要“读取”操作即可。看一下 CQS(CQRS) 模式。
It's better to use queries for reports because you need nothing but "read" operations there. Take a look at CQS(CQRS) pattern.