Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1012359
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T09:56:04+00:00 2026-05-16T09:56:04+00:00

I have a solution where i have 3 WPF projects under it (Project UI-A,

  • 0

I have a solution where i have 3 WPF projects under it (Project UI-A, Project UI-B and Project named CommonLibrary(Data Layer).I have a user registration form in the Project UI-A where i will capture the User profile information. And in the CommonLibrary project i have a class called UserCommon which will have a method to save the data to the db table. I am using LINQ 2 SQL to talk to the db in CommonLibrary project. In the Project UI-A i will have a dropdonw list which has options like Development and Production Using which i can choose where this operation to be done.

Now how can i tell the method in CommonLibrary to use which datacontext (Development or Production)? Is passing a variable (to mention its development or production)
in all the methods as a parameter is the only way? What are the other alternatives?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T09:56:05+00:00Added an answer on May 16, 2026 at 9:56 am

    I’d suggest putting the setting in your app.config file, and access it through the ConfigurationManager. What you don’t want is a variable set in code.

    Another option is to use a dependency injection tool that builds its configuration from an external file. However, that’s usually not the way people want to configure dependency injection. (That’s much cleaner in code.)

    You can also build a factory method that generates DataContext objects, pre-configured for the correct configuration. That isolates the decision to a single method.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 524k
  • Answers 524k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer There is the Maven Properties Guide. Check also the chapter… May 16, 2026 at 9:58 pm
  • Editorial Team
    Editorial Team added an answer I'd use a view model, like: var catList = (from… May 16, 2026 at 9:58 pm
  • Editorial Team
    Editorial Team added an answer The first snippet cannot work because aTreeView is a reference… May 16, 2026 at 9:58 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I currently have a VS Solution with 2 projects: a WPF application and a
I have a WPF application (KaleidoscopeApplication) organized as follows: Solution (6 projects) Cryptography (DLL)
There are two projects in one VS solution: client(wpf app) and а wcf service
I have a WPF application which saves its data to XML files in a
I have a solution with over 100 projects. It takes a long time to
I have developed a solution in Visual Studio 2008 C# WPF! I'm using a
OK. I was going a little crazy today with a WPF project. I'm using
Using the WPF DataGrid I have the need to change various display and related
I have seen this question: How to keep WPF TextBox selection when not focused?
It seems like it would behoove me to learn this GDI replacement, WPF. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.