Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4 > ASP.NET 4 General Discussion
|
ASP.NET 4 General Discussion For ASP.NET 4 discussions not relating to a specific Wrox book
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 4 General Discussion 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 June 2nd, 2013, 07:58 AM
Friend of Wrox
 
Join Date: Oct 2009
Posts: 341
Thanks: 14
Thanked 3 Times in 3 Posts
Default

Hi Imar,
the download link to sample file is this.

Please check this.
 
Old June 2nd, 2013, 10:42 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

If I understand you correctly, this just works because LINQ to SQL embeds the connection string in the assembly and uses it as a default when no connection string is defined in the config file.

IMO, this is very undesirable as it means you need to redeploy your assemblies whenever the database connection string changes. The alternative to that is to use a connection string in the config file which is exactly what EF does.

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!
 
Old June 3rd, 2013, 01:41 PM
Friend of Wrox
 
Join Date: Oct 2009
Posts: 341
Thanks: 14
Thanked 3 Times in 3 Posts
Default

Thanks Imar for clarification.

But apart from what EF provides (whether it is functionality), is not it possible with EF what L2S provides?
 
Old June 3rd, 2013, 02:09 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

It is possible Both ObjectContext and DbContext have a constructor that lets you pass in a connection string. That way you can hardcode the connection string so it gets embedded in the assembly:

http://msdn.microsoft.com/en-us/libr...ctcontext.aspx
http://msdn.microsoft.com/en-us/libr...vs.103%29.aspx

But again: I would recommend against this as it means embedding the connection string in the assemblies.

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!
 
Old July 1st, 2013, 01:05 PM
Friend of Wrox
 
Join Date: Oct 2009
Posts: 341
Thanks: 14
Thanked 3 Times in 3 Posts
Smile

Thanks Imar,
it worked.
 
Old July 5th, 2013, 12:56 AM
Authorized User
 
Join Date: Jun 2013
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for clearing it out there...really appreciate that..
__________________
REI Coupon





Similar Threads
Thread Thread Starter Forum Replies Last Post
using entity framework 5 misuk11 BOOK: Professional ASP.NET Design Patterns 1 February 25th, 2014 05:23 PM
Entity Framework vbboyd BOOK: Beginning ASP.NET 4.5 : in C# and VB 5 January 18th, 2013 11:48 AM
Hosting and the web.config file, connection string for Entity jdlferreira BOOK: Beginning ASP.NET 4 : in C# and VB 56 November 10th, 2012 01:19 AM
The BeerHouse and Entity Framework docluv BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 0 October 3rd, 2008 01:32 PM





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