Wrox Programmer Forums
|
BOOK: Beginning ASP.NET 4.5 : in C# and VB
This is the forum to discuss the Wrox book Beginning ASP.NET 4.5: in C# and VB by Imar Spaanjaars; ISBN: 978-1-118-31180-6
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 4.5 : in C# and VB section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 20th, 2014, 05:46 PM
Authorized User
 
Join Date: Nov 2013
Posts: 84
Thanks: 29
Thanked 2 Times in 2 Posts
Default ch 12-14 Databases

Hi Imar,

The book teaches us how to use SQL Data Sources and Entity Framework Sources. Clearly you needed to teach both methods, but having learned them, I'd now like to ask for some perspective on these data sources.

(1) In the book project, ultimately EF also connects to SQL (there is a SQL connection string embedded in the "...Entities connection string" element in web.config). Does it have to? Can EF setup 'by itself' within VS?

(2) In practice is there any reason we would need to have both methods in use? If so, why would that be? If not, then is the Entity Framework the superior choice? It seems as though anything that can be done using SQL Data Sources can be accomplished through the EF Data Sources as well. Is that correct, or are there some subtle issues that might cause one to retain both methods in a given project? As I continue to review each aspect of the project site I see that the Providers use the 'standard' SQL connection string. Can they use the EF connection, or is that forbidden?

(3) Also, in the book, we connected to SQL first before we setup for EF operations ( Fig 14-2, we needed the SQL connection string). If the SQL connection had not already been present, how would we have connected/setup the EF without having first setup SQL?

(4) On a more specific note, if we use the ListView and want to have full CRUD operations, are we committed to having to delete in markup the columns we don't want to display? I also ran into a problem where I had deleted several columns in the markup, but the grid display seemed to be 'hanging on' to a 1-2 pixel width column for each of the deleted fields that looked weird. Is there a proscribed way to eliminate totally the columns you don't want to display in the ListView?

Thanks.

Best Regards,
Alan

Last edited by AlanWheeler; February 20th, 2014 at 07:04 PM.. Reason: updated item 2
 
Old February 20th, 2014, 08:16 PM
Registered User
 
Join Date: Feb 2014
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Bras

On a more specific note, if we use the ListView and want to have full CRUD operations, are we committed to having to delete in markup the columns we don't want to display? I also ran into a problem where I had deleted several columns in the markup, but the grid display seemed to be 'hanging on' to a 1-2 pixel width column for each of the deleted fields that looked weird. Is there a proscribed way to eliminate totally the columns you don't want to display in the ListView?
 
Old February 21st, 2014, 02:30 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi Alan,

Quote:
(1) In the book project, ultimately EF also connects to SQL (there is a SQL connection string embedded in the "...Entities connection string" element in web.config). Does it have to? Can EF setup 'by itself' within VS?
EF can target other databases as well, but not "by itself"; it always targets a database. See here for more info: http://stackoverflow.com/questions/1...ious-databases

Quote:
(2) In practice is there any reason we would need to have both methods in use? If so, why would that be? If not, then is the Entity Framework the superior choice? It seems as though anything that can be done using SQL Data Sources can be accomplished through the EF Data Sources as well.
It's a matter of choice and preference. The SqlDataSource is easier to use at first, but harder to maintain in the long run. EF is a bit more complicated to learn, but more powerful.
Quote:
Can they use the EF connection, or is that forbidden?
Nope, that doesn't work. EF uses its own format with a traditional connection string embedded in its own connection string.

Quote:
(3) Also, in the book, we connected to SQL first before we setup for EF operations ( Fig 14-2, we needed the SQL connection string). If the SQL connection had not already been present, how would we have connected/setup the EF without having first setup SQL?
Yes, you'll get a dialog to create a connection.

Quote:
(4) On a more specific note, if we use the ListView and want to have full CRUD operations, are we committed to having to delete in markup the columns we don't want to display? I also ran into a problem where I had deleted several columns in the markup, but the grid display seemed to be 'hanging on' to a 1-2 pixel width column for each of the deleted fields that looked weird. Is there a proscribed way to eliminate totally the columns you don't want to display in the ListView?
That doesn't sound right. Deleting the fields should remove them completely. Maybe there was whitespace between the various elements in the template?

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!
The Following User Says Thank You to Imar For This Useful Post:
AlanWheeler (February 21st, 2014)





Similar Threads
Thread Thread Starter Forum Replies Last Post
Sql 2000 version of Chp.12 databases studen77 BOOK: Professional ASP.NET 2.0 Server Control and Component Development ISBN: 978-0-471-79350-2 2 December 2nd, 2015 01:42 PM
Ch.14 first try it out lrk89 BOOK: Beginning ASP.NET 4 : in C# and VB 7 February 10th, 2014 05:12 PM
Ch.14 - First try it out jxFive BOOK: Beginning ASP.NET 4 : in C# and VB 3 November 3rd, 2011 03:55 PM
Ch 14 Help digink BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 3 November 3rd, 2009 03:35 PM
Ch. 4 & Ch. 12 athena BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 0 July 23rd, 2004 10:54 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.