Reputation:
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:
you don’t have to write data access logic (thus you don’t have to create SqlCommand, SqlConnection etc, and you also don’t have to create Datareader or DataSet)
you are able to see in VS designer what columns will select query produce
you can bind parameters to other controls
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
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
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:
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