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

  • SEARCH
  • Home
  • 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 6584179
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T16:30:16+00:00 2026-05-25T16:30:16+00:00

My structure of database (domain, data and services) are the same as : This

  • 0

My structure of database (domain, data and services) are the same as : This application (MyFinance on CodePlex)

The problem is, that i have 2 database contexts (1 MyMasterContext) and 1 MySlaveContext.

And suppose that MySlaveContext can always be a different database / providerName / server.
(I know Entity Framework only supports MS SQL Server in EF 4.1)
MyMasterContext ALWAYS stays the same, this is where all the custom connectionstrings are saved.

So, my connectionstring can always change when i address the MySlaveContext, depending on which user is logged in.

In the current situation, MyMasterContext is always being auto-generated when it’s used, so is the MySlaveContext.

Now i have to add “dynamic connectionstring” support, the only problem is, that i don’t know where to add this functionality…

I have already implemented the ConnectionString in my UserIdentity (UserData), so it is always available when doing:

 DirectCast(User.Identity,MyCustomUserIdentity).ConnectionString

Same with the ProviderName.

Also, my DataBaseFactory and UnitOfWork are “duplicated”, because i have one for the Master and one for the Slave (just to be sure).

Could someone help me how to add the “ConnectionString-detection” support?

I thought i could add it as a PropertyInjection or ParameterInjection in Unity, but i don’t have enough experience in this field to know it’s right or how to do it 🙂

Thanks in advance for anyone who could bring me on the right track 🙂

  • 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-25T16:30:17+00:00Added an answer on May 25, 2026 at 4:30 pm

    Fixed it myself by using an InjuctionConstructor..

    In global.asax

     GetUnityContainer.RegisterType(GetType(ISlaveConnectionString), GetType(SlaveConnectionString), New HttpContextLifetimeManager(Of ISlaveConnectionString), New InjectionConstructor(IIf(HttpContext.Current.User IsNot Nothing, DirectCast(HttpContext.Current.User, UserIdentity).ConnectionString, "")))
    

    It’s a parameter that can be supplied to a method. In this case, i’m updating my ConnectionString.

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

Sidebar

Related Questions

I have a postgresql database that has this column structure: Author id name Book
I have a database structure that has a Person table which contains fields such
Ok, I have an app as described in this post: https://stackoverflow.com/questions/1623105/good-database-structure-for-a-new-web-app I've prepared a
My database structure looks something like this: Person Id Name FieldA FieldB Phone Id
I have mysql database structure like below: CREATE TABLE test ( id int(11) NOT
Basically I do have pretty simple database that I'd like to index with Lucene.
I currently have a database structure with two important tables. 1) Food Types (Fruit,
I've designed a database structure where data is collected about cars over a period
In host1 with domain http://domain1 I am using ajax with structure: index.php (that is
I have the following database structure: Children --> Gifts <-- Possible_gifts, where the arrow

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.