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 8680519
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T21:16:20+00:00 2026-06-12T21:16:20+00:00

If I install a provider while my app is running. And then call DbProviderFactories.GetFactory(providerClass)

  • 0

If I install a provider while my app is running. And then call DbProviderFactories.GetFactory(providerClass) to see if it is installed, I get an exception calling it. But if I exit my app and the re-start it, then it sees it.

What do I have to call to get DbProviderFactories.GetFactory(providerClass) to re-read machine.config?

  • 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-06-12T21:16:22+00:00Added an answer on June 12, 2026 at 9:16 pm

    The provider information is read in static data table when first time used and then that value is always returned until application restarts and that data table is of course again re-created.

    The following code (first published at Windward Wrocks) will flush that internal cache and force a re-read:

    /// <summary>
    /// Force DbProviderFactories to re-read machine.config on the next call to
    /// DbProviderFactories.GetFactoryClasses().
    /// </summary>
    static public void FlushDbProviderFactoriesCache()
    {
      try
        {
        FieldInfo initStateFieldInfo = typeof(DbProviderFactories).GetField("_initState",
                                      BindingFlags.Static | BindingFlags.NonPublic);
        if (initStateFieldInfo != null)
          {
            ConnectionState state = ConnectionState.Closed;
            object initState = initStateFieldInfo.GetValue(state);
            if (initState is ConnectionState)
            {
              state = (ConnectionState)initState;
              if (state != ConnectionState.Closed)
                initStateFieldInfo.SetValue(state, ConnectionState.Closed);
              ConfigurationManager.RefreshSection("system.data");
            }
          }
        }
      catch (Exception)
        {
        // nada
        }
      }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi I am getting the following invalid liscence exception while calling a secured URL
I get this error while running bundle exec /usr/lib/ruby/gems/1.8/gems/bundler-1.0.20/lib/bundler/cli.rb:344:in `exec': wrong number of arguments
It's basically one app that is installed on multiple PC's, each install maintaining it's
May I install a search provider/accelerator remotely in Internet Explorer 8? I dont want
I'm trying to install the Subversion team provider on Eclipse 3.5, and it fails
We install Matlab Runtime on a machine, then we restart a .net windows service
I have a Python app on Heroku running with Django. The app launches and
I'm getting the Microsoft.ACE.OLEDB.12.0 provider is not registered error on my asp.net application while
I am trying to install mysql2 gem in my windows machine and I get
WhenI run (as root) gem install pg -v '0.12.0' -- --with-pg-config=/usr/pgsql-9.1/bin/pg_config I get the

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.