Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 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
 
 
Thread Tools Display Modes
  #1 (permalink)  
Old September 30th, 2008, 02:22 PM
Registered User
 
Join Date: Sep 2008
Location: , , .
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)

  #2 (permalink)  
Old September 30th, 2008, 02:49 PM
Lee Dumond's Avatar
Wrox Author
Points: 4,942, Level: 29
Points: 4,942, Level: 29 Points: 4,942, Level: 29 Points: 4,942, Level: 29
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2008
Location: Decatur, IL, USA.
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);
  #3 (permalink)  
Old October 1st, 2008, 07:37 AM
Registered User
 
Join Date: Sep 2008
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks!

 


Thread Tools
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
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 02: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 16th, 2009 11:22 PM
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 10th, 2007 11:54 PM



All times are GMT -4. The time now is 03:34 PM.


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