November 28, 2005
|
ObjectDataSource: pros and cons
|
5426 hit(s)
Someone internally asked about the benefits and disadvantages of using the ObjectDataSource control. Eilon Lipton from our team responded with the following:As the author of the ObjectDataSource, I might be a bit biased, but here's a start:
Pros- Automatic two-way databinding with data bound controls such as the GridView and FormView
- Automatic binding of method parameters to other pieces of data (ControlParameter, QueryStringParameter, etc.) for Select/Insert/Update/Delete
- Better separation of UI and code
- Hooks up easily to VS Data Components
- Better design time support in data bound controls. For example, you object's schema appears in the GridView's "Edit Columns" dialog.
Cons- Slight performance hit. I don't recall what our measurements were, but the hit was definitely under 10% for a Select method that returned static data. Keep in mind that with a "real" data object, the Select method would go to a database or somewhere else fairly slow (as compared to returning static data). As such, the hit in a real scenario is probably quite a bit less.
- Requires specific patterns for writing business objects. It's fairly flexible, but some scenarios are tricky to work with.
There you go -- straight from the, uh, author's mouth.