November Happy Hour will be moved to Thursday December 5th.

Rename connection string in .NET

Vote:
 

I have this connection string:

<connectionStrings><clear /><add 
    name="EPiServerDB"..../></connectionStrings>

And was wondering if it is possible to rename it to something else other that EPiServerDB. Is it possible? We really need that on the current project as this name conflicts with another connection string which we hoped to use from an earlier project. The reason why is that we are integrating the old business layer into our new solution.

We are using EPiServer CMS 7, if that matters.

#70799
Apr 30, 2013 15:49
Vote:
 

Hi,

 

You will need to do a few steps to change this:

 

1. Add new section handler in web.config (if not present):

<section name="episerver.dataStore" type="EPiServer.Data.Configuration.EPiServerDataStoreSection, EPiServer.Data" />

    

2. Then add connection string name for your site (site Id is coming from episerver.framework section - usualy EPiServerFramework.config file):

 

<episerver.dataStore>
  <siteDataSettings>
    <add siteId="{SITE-ID}" connectionStringName="{NAME-YOUR-CONNECTION}" />
  </siteDataSettings>
</episerver.dataStore>

    

 

Hope that helps!

#70821
May 01, 2013 12:50
Vote:
 

I had to rename all other references to that connection string as well. Other than that, it works. Can you explain what those settings I added do?

#70833
May 02, 2013 9:10
Vote:
 

Yes, forgot to mention that you will need to udpate all other references to newly named connection (role providers, membership providers, etc).

When connection factory is initialized EPiServer asks for configuration data from data store configuration class (somewhere in EPiServer.Configuration & EPiServer.Data assemblies). By default there is convention (or default value) for connection string name ("EPiServerDB") which will be searched for in <connectionStrings> section or file. Using <dataStore> & <siteDataSettings> elements your are able to override default conventions.

#70834
May 02, 2013 9:18
Vote:
 

Nice, thanks!

#70857
May 02, 2013 12:16
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.