If ObjectDataSource isn't the answer for a lar

2019-02-24 07:20发布

Quoting the answer of Andrew Hare on the This Question.

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 + ......

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?

2条回答
ら.Afraid
2楼-- · 2019-02-24 08:09

There is no doubt that ObjectDataSource makes the binding process easier.

It handles filtering, paging etc..with less headache.

Points to be considered.

  • View(.aspx) has reference to the Business object so it restricts some of the tasks like Refactoring while the application grows bigger.
  • Many application nowadays use IoC and ODS does not support that.
  • ODS works on parameters and if filter conditions increase we have to increase no. of parameters in the Business which is also not desirable.

So if we consider all these points ODS does not scale well.

查看更多
我想做一个坏孩纸
3楼-- · 2019-02-24 08:16

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.

查看更多
登录 后发表回答