为list<>比数据集在ASP.Net UI层更好? [英] Is List<> better than DataSet for UI Layer in ASP.Net?

查看:188
本文介绍了为list<>比数据集在ASP.Net UI层更好?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从我的数据访问层数据转化为我的业务层,然后prepare它在我的UI使用。

I want to get data from my data access layer into my business layer, then prepare it for use in my UI.

所以我想:是不是最好通过的DataReader 来读我的数据,并用它来填补列表< BLClasses> 或填补了的DataSet 并发送的DataSet UI层??

So i wonder: is it better to read my data by DataReader and use it to fill a List<BLClasses> or to fill a DataSet and send the DataSet to UI Layer ??.

我很感兴趣,良好的性能和可扩展性。

I'm interested in good performance and scalability.

推荐答案

您的UI层应该从你的数据访问策略远删除 - 它不应该被处理的原始数据。因此,您的UI应与你的域对象(直接或通过一个服务层)纯粹沟通。

Your UI layer should be far-removed from your data access strategy - it shouldn't be dealing with raw data. Thus, your UI should communicate solely with your domain objects (directly or through a service layer).

可以再有UI层创建,它为了使所需要的数据结构。任何性能问题可以通过一个缓存策略来缓解。

You can then have the UI layer create the data structures that it needs in order to render. Any performance concerns could be mitigated through a caching strategy.

这会影响code应该始终是任何设计的长期和短期目标的可读性,可测试性和可维护性。

This affects the readability, testability and maintainability of the code which should always be long- and short-term goals of any design.

我觉得最好你会希望看到这些方针的东西:

I think ideally you'd want to see something along these lines:


 UI
 /|\
  |
SERVICE (? depending on the design)
 /|\
  |
DOMAIN
 /|\
  |
 DCO
 /|\
  |
 DAL

编辑:

在另一端,如果你正在构建一个非常直接的WebForms应用程序,那么你可以放弃一些这种复杂性,只使用由Visual Studio提供的设计师。然而,我发现,应用程序常常进化超越了拖和拖放界面的功能,你最终不得不重构为一个更加分离的设计。

On the flip-side, if you're building a very straight-forward WebForms application, then you may be able to forgo some of this complexity and just use the designers provided by Visual Studio. I've found, however, that applications often evolve beyond the capabilities of the drag-and-drop interface and you end up having to refactor into a more separated design.

您总是需要知道你进账/通过选择一个架构策略失去什么。如果你能活(在边缘),没有测试,降低了可读性和用户界面的更紧密的耦合到数据的 ** **不寒而栗,然后或许更直接的方法是给你的。

You always need to know what you stand to gain/lose by choosing an architectural strategy. If you can live (on the edge) with no testing, reduced readability and tighter coupling of the UI to the data **shudder**, then perhaps the more straight-forward approach is for you.

进一步阅读一些链接

  • SOLID principles of OOD
  • Fowler's PoEE
  • MSDN: Patterns and Practices

这篇关于为list&LT;&GT;比数据集在ASP.Net UI层更好?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆