如果 ObjectDataSource 不是大型应用程序的答案,那是什么? [英] If ObjectDataSource isn't the answer for a large application, what is?

查看:20
本文介绍了如果 ObjectDataSource 不是大型应用程序的答案,那是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Andrew Hare 的回答questions/882817/object-datasource-or-code-behind-which-is-better">这个问题.

Quoting the answer of Andrew Hare on the This Question.

对象数据源非常适合小型项目,但它们的扩展性不如您正在嵌入数据层您的 UI 层中的信息应用.我建议你仅将它们用于非常小的应用程序和便笺式测试东西.如果您做出设计决定使用它们做好斗争的准备扩展和维护问题未来.

Object data sources are nice for small projects but they do not scale well as you are embedding data-layer information in the UI layer of your application. I would suggest that you only use them for very small applications and scratch-pad testing stuff. If you make a design decision to use them be prepared to struggle with scaling and maintenance issues in the future.

应用架构 = 可维护性 + 可扩展性 + ......

Application Architecture = Maintainability + Scalability + ......

而且我认为,我读过的每一篇开始学习应用程序架构的文章都使用一些类来构建业务数据层,并使用 ObjectDataSource 将表示层与业务层连接起来.

And I think, every article that I've read to start learning application architecture used some classes to build up the business data layer and used ObjectDataSource to connect the presentation layer with the business layer.

看来我错了.用于业务层及其与表示层的连接的最佳方法是什么?

Looks like I've got all wrong. What's really the best approach to use for the business layer and its connection with the presentation layer?

推荐答案

我不使用 ObjectDataSource;个人比较喜欢对绑定过程的控制,所以直接通过DataSource属性绑定,不使用DS控件.因为 DS 控制何时绑定或不绑定,我不喜欢利用事件来取消绑定,只是因为我不想在那个特定时间这样做......它可以掩盖某些类型的编码错误,使其更难调试,但是如果有错误,我相信你可以点击selected,inverted等事件并处理错误.

I don't use the ObjectDataSource; personally, I like the control over the binding process, so I bind directly through the DataSource property, and not use the DS controls. Because the DS controls when to bind or not bind, I dislike tapping into events to cancel binding only because I didn't want to do it at that specific time... It can mask some types of coding blunders, making it harder to debug, but if there is an error, you can tap into the selected, inserted, etc. event and handle the error, I believe.

然而,我不明白为什么它是错误的;我不太确定为什么它不能很好地扩展......如果它对你有用,并且当你测试性能还可以,那么我为什么不说.

However, I don't see why its wrong; I am not quite sure why it wouldn't scale well... if it works for you, and when you test the performance is OK, then why not I would say.

HTH.

这篇关于如果 ObjectDataSource 不是大型应用程序的答案,那是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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