一直有人告诉我,使用 3 层模型设计应用程序是将数据层和业务逻辑层与表示分离的最佳实践。
但是当我开始使用现代用户界面组件(比如 DevExpress)时,我会失去很多很棒的功能,比如动态过滤、分页、动态加载等。
并且您应该实现自己的方法,允许用户控件保留这些功能。
我从 Nhibernate 的 Ayende 那里读到了那些文章:
http://ayende.com/blog/3958/the-dal-should-go-all-the-way-to-ui
http://ayende.com/blog/3955/repository-is-the-new-singleton
http://ayende.com/blog/4567/the-false-myth-of-encapsulating-data-access-in-the-dal
现在我很困惑!这是否意味着我可以在我的 UI 中引用 Nhibernate?例如,我可以有如下代码:
GridView.DataSource = session.Query<Order>();