ObjectDataSource vs manual binding

L

Leon Mayne

We have static functions in our data access layer that return generic lists
of our business objects, such as this:

Public Shared Function AllUsers() as Generic.IList(of OurUserObject)
Dim colUsers as New Generic.List(of OurUserObject)
' Populate collection here
Return colUsers
End Function

These methods are used thoughout the code, but in some aspx files we would
like to have a drop down list which retrieves data from these methods (e.g.
to allow the user to pick a user from the database). I've so far been using
an ObjectDataSource control linked to the above method and a drop down list
bound to the ObjectDataSource. This works fine. However, our senior
developer has never used the built in 2005 data objects and does not like
them, and prefers to do manual binding in the Page_Load event.

Is it better in the above scenario to use to use an ObjectDataSource or to
do the binding yourself? Can anyone cite any articles that give reasons why
using the DataSource objects are a good or bad thing? Bear in mind this is
an enterprise application, so simplicity is not really an issue.
 
M

Michael Nemtsev [MVP]

Hello Leon,

See there http://sgdotnet.org/blogs/chuawench..._-ObjectDataSource-versus-Custom-Binding.aspx
for example

I'm for the build-in objects, but if u are not using them as components on
your forms :)
I see there advantages that u relies on the existed classess which are the
part of .NET FW and doesnt invent the wheel.
it helps you extend your knowlege of .NET FW and improve the development
speed reusing the standard classess

---
WBR,
Michael Nemtsev [.NET/C# MVP] :: blog: http://spaces.live.com/laflour

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo


LM> We have static functions in our data access layer that return
LM> generic lists of our business objects, such as this:
LM>
LM> Public Shared Function AllUsers() as Generic.IList(of OurUserObject)
LM> Dim colUsers as New Generic.List(of OurUserObject)
LM> ' Populate collection here
LM> Return colUsers
LM> End Function
LM> These methods are used thoughout the code, but in some aspx files we
LM> would like to have a drop down list which retrieves data from these
LM> methods (e.g. to allow the user to pick a user from the database).
LM> I've so far been using an ObjectDataSource control linked to the
LM> above method and a drop down list bound to the ObjectDataSource.
LM> This works fine. However, our senior developer has never used the
LM> built in 2005 data objects and does not like them, and prefers to do
LM> manual binding in the Page_Load event.
LM>
LM> Is it better in the above scenario to use to use an ObjectDataSource
LM> or to do the binding yourself? Can anyone cite any articles that
LM> give reasons why using the DataSource objects are a good or bad
LM> thing? Bear in mind this is an enterprise application, so simplicity
LM> is not really an issue.
LM>
 
E

Eliyahu Goldin

It is neaither good or bad. One just needs to understand what it is and use
it appropriately.

xxxDataSource classes and declarative databinding are intended to make
development simplier. Naturally, flexibility suffers as you don't have full
control over databinding.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,982
Messages
2,570,186
Members
46,744
Latest member
CortneyMcK

Latest Threads

Top