JustTryingToLearn
JustTryingToLearn

Reputation:

Benefits of using data source controls for binding

I've started learning data source controls

To my understanding, the only benefits of using data source controls instead of using regular data binding are the following:

a) Are there any other benefits of using data source controls?

b) As for data source controls relieving you of the tedious task of writing data access logic: Don’t data source controls in fact spare you of writing 10 lines of code at max? Is that really so beneficial or am I again missing something quite obvious?

bye

Upvotes: 2

Views: 282

Answers (2)

eglasius
eglasius

Reputation: 36035

On the benefits listed:

"thus you don’t have to create SqlCommand, SqlConnection etc" - linq2sql, entity framework, or [insert a good ORM here] are much better to help you on this. Say you want to display a of Companies with their top 3 employees in a ListView, using a plain old sql query doesn't play so well to get it up quickly (and working right i.e. not hitting the database separately to get top 3 employees for each company you are displaying)

On additional benefits: You can tell it to cache right there

On comparing it to the tedious task of writing data access logic: see above :)

Ps. My personal opinion is that it certainly pushes you to a pattern where the code is more tied up to the UI. I kept the answer on the points that address the question more directly.

Upvotes: 1

Gregory A Beamer
Gregory A Beamer

Reputation: 17010

My normal use of the "data source" bits is to more quickly set up my grids and forms. Once done, I will bind using other methods, as I do not want two artifacts that are common to the drag and drop UI:

  1. Munging of all layers into one control
  2. Reliance on extra FUD to keep the app working

But, using the data source to set up UI? Yeah, that is pretty cool. Outside of the box? Certainly. :-)

I am a big fan of drag and drop to do the mundane, but I am not fond of something that holds me inside a box.

Upvotes: 0

Related Questions