Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4 > BOOK: Beginning ASP.NET 4 : in C# and VB
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Beginning ASP.NET 4 : in C# and VB
This is the forum to discuss the Wrox book Beginning ASP.NET 4: in C# and VB by Imar Spaanjaars; ISBN: 9780470502211
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 4 : in C# and VB section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old March 18th, 2014, 02:28 PM
Authorized User
Points: 125, Level: 2
Points: 125, Level: 2 Points: 125, Level: 2 Points: 125, Level: 2
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2010
Location: Seltjarnarnes, Iceland
Posts: 27
Thanks: 10
Thanked 0 Times in 0 Posts
Default SqlDataSource vs EntityDataSource

Hi, there.

Currently, I am building a site, relying heavily on the Beginning ASP.NET 4 book.
As far as I can see, one can choose to work with either SqlDataSources or EntityDataSources. Both are used in the book and, if I am correct, which way you go is mainly a matter of choice. Everytning you can do with a SqlDataSource can be done with a EntityDataSource and vice versa. Am I right?

In chapter 13 of the book, SqlDataSources are used in connection with DataGridView and DetailsView. Then, in chapter 14, EntityDataSources are used for GridView, Repeater an ListView controls. Is there a particular reason for this choice of data source type other than introducing the reader to LINQ and the ADO.NET Entity Framework?
__________________
Regards,
Gudni G. Sigurdsson
Reply With Quote
  #2 (permalink)  
Old March 18th, 2014, 03:06 PM
Imar's Avatar
Wrox Author
Points: 72,022, Level: 100
Points: 72,022, Level: 100 Points: 72,022, Level: 100 Points: 72,022, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,076
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Both have their pros and their cons. The SqlDataSource is easy to set up, but harder to maintain. If you rename tables or columns, you won't notice your SQL is broken until you run the page.
The EntityDataSource is, at first, harder to set up and configure, but then provides better (but not perfect) type checking.

However, the EntitDataSource control is now considered obsolete. Instead, you're advised to use Model Binding: http://blogs.msdn.com/b/webdev/archi...web-forms.aspx

This requires a more recent version of .NET / Visual Studio than this book targets but if you happen to use VS 2012 or later, this is the way forward.

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
Reply With Quote
The Following User Says Thank You to Imar For This Useful Post:
Gudni (March 19th, 2014)
  #3 (permalink)  
Old March 19th, 2014, 04:18 AM
Authorized User
Points: 125, Level: 2
Points: 125, Level: 2 Points: 125, Level: 2 Points: 125, Level: 2
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2010
Location: Seltjarnarnes, Iceland
Posts: 27
Thanks: 10
Thanked 0 Times in 0 Posts
Default

Thank you, Imar.
Being a relatively inexperienced web developer, I am learning many new things at the same time. But I will certainly have a look at Model Binding. The site I mention in my post, is done with VS 2010, but I have recently installed VS 2013 and will inspect MB in due time.
__________________
Regards,
Gudni G. Sigurdsson
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
CH 14 A Simple EntityDataSource Application - Error! leeWozyWarren BOOK: Beginning ASP.NET 4 : in C# and VB 5 December 7th, 2011 02:28 PM
EntityDataSource Try it Out Exercise Page 497 bimalk BOOK: Beginning ASP.NET 4 : in C# and VB 6 December 5th, 2011 01:27 PM
Update multiple tables with EntityDataSource alharlow ASP.NET 4 General Discussion 3 March 31st, 2011 03:15 AM
Error with EntityDataSource TeaDrinkingGeek BOOK: Beginning ASP.NET 4 : in C# and VB 3 March 20th, 2011 01:54 PM
Questions about EntityDataSource and dynamic binding Rushino ASP.NET 4 General Discussion 4 November 22nd, 2010 09:58 AM



All times are GMT -4. The time now is 04:54 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.