Wrox Programmer Forums
|
BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0
This is the forum to discuss the Wrox book ASP.NET 2.0 Website Programming: Problem - Design - Solution by Marco Bellinaso; ISBN: 9780764584640
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 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 September 30th, 2008, 02:22 PM
Registered User
 
Join Date: Sep 2008
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default LINQ to SQL in TheBeerHouse

Hi,

I just wondering if using LINQ to replace the DAL, if the development Data base server is different from Test and production data base server, how the application knows to switch from Development Database to test and production database in the DBML. It seems the connection to database is built right in the DBML. After compile it, how to change the connection? (If use ADO, the connection string can be changed in web.config file, or use Key in Appsettings to indicate weather it is development, or test, or production, the connection string can be dynamically built in code by testing the Key value)

 
Old September 30th, 2008, 02:49 PM
Lee Dumond's Avatar
Wrox Author
 
Join Date: Jan 2008
Posts: 923
Thanks: 12
Thanked 166 Times in 162 Posts
Default

You can use any connection string you want by specifying it in an overload of the DataContext constructor. That way, the DBML will ignore its own connection string use the one you supply to it.

So, instead of this:

MyDataContext context = new MyDataContext();

You would use:

MyDataContext context = new MyDataContext(myConnectionString);
 
Old October 1st, 2008, 07:37 AM
Registered User
 
Join Date: Sep 2008
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks!






Similar Threads
Thread Thread Starter Forum Replies Last Post
LINQ-ifying TheBeerHouse available jminatel BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 6 February 5th, 2010 03:37 PM
LINQ to SQL example for TheBeerHouse in Wrox Blox jminatel BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 51 January 17th, 2009 12:22 AM
Technical Editor: LINQ and TheBeerHouse Wrox Blox jminatel BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 5 August 30th, 2008 12:11 AM
LINQ-ifying TheBeerHouse - An Alternate Approach Lee Dumond BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 19 May 22nd, 2008 01:24 AM
Can I use TheBeerHouse with SQL Server 2000? vnuser BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 2 February 11th, 2007 12:54 AM





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