0 Replies Latest reply: Mar 12, 2012 10:33 AM by Invincible RSS

    Change connection string

    Invincible
      Hi,
      I know that this is a feature request but I'm thinking that it's not too hard to be implemented.

      In our solution we're connecting to multiple databases and we're building connection string runtime.
      Now we're using reflection to change connection string:

      private void SetProvidersConnectionString()
      {
      var connectionString = SessionManager.Manager.ConnectionString;
      FieldInfo connectionMembershipField = typeof(OracleMembershipProvider).GetField(
      "m_OracleConnectionString", BindingFlags.Instance | BindingFlags.NonPublic);
      connectionMembershipField.SetValue(Membership.Provider, connectionString);

      FieldInfo connectionRoleField = typeof(OracleRoleProvider).GetField(
      "m_OracleConnectionString", BindingFlags.Instance | BindingFlags.NonPublic);
      connectionRoleField.SetValue(Roles.Provider, connectionString);

      FieldInfo connectionProfileField = typeof(OracleProfileProvider).GetField(
      "m_OracleConnectionString", BindingFlags.Instance | BindingFlags.NonPublic);
      connectionProfileField.SetValue(ProfileManager.Provider, connectionString);

      FieldInfo connectionSiteMapField = typeof(OracleSiteMapProvider).GetField(
      "m_connectionString", BindingFlags.Instance | BindingFlags.NonPublic);
      connectionSiteMapField.SetValue(SiteMap.Provider, connectionString);

      }

      Can you expose the Connection String property to public.