Loading...
Area: Optimizely CMS
Applies to versions: 10-11
Other versions:
ARCHIVED This content is retired and no longer maintained. See the version selector for other versions of this topic.

Configuring episerver.dataStore

Recommended reading 

The following XML pseudocode describes the <episerver.dataStore> section of the configuration file. The Configuration topic describes the syntax used in the description of the configuration elements. <episerver.dataStore> matches the classes in EPiServer.Data.Configuration.

<episerver.dataStore>

<episerver.dataStore>
   <dataStore autoRemapStores="bool"
              autoResolveTypes="bool"
              defaultProvider="string"
              deleteAllOperationTimeout="int" >
      <cache defaultProvider="string">
         <providers>
            <add description="string"
                 name="string"
                 type="string" />
            ...
         </providers>
      </cache>
      <providers>
         <add description="string"
              name="string"
              type="string" />
         ...
      </providers>
   </dataStore>
   <entity>
      <providers>
         <add name="string"
              type="string" />
         ...
      </providers>
      <supportedTypes>
         <add provider="string"
              type="string" />
         ...
      </supportedTypes>
   </entity>
   <dataSettings connectionStringName="string"
                 retries="int"
                 retryDelay="timespan"
                 databaseQueryTimeout="timespan" />
</episerver.dataStore>

<episerver.dataStore> Element Attribute

Name Default value Description
databaseMode  ReadWrite The database mode can be configured by the databaseMode attribute on the episerver.dataStore section or by the episerver:DatabaseMode setting under the appSettings section. See Database mode for more information.

<dataStore> Element Attributes

The dataStore element is optional. Configuration values in web.config override default values in code.
Name Default value Description
autoRemapStores  true Defines whether stores are automatically remapped when a type definition changes.
autoResolveTypes  true Defines whether type resolution by the Dynamic Data Store is automatic.
defaultProvider  EPiServerSQLServerDataStoreProvider The name of the default provider. A provider with the specified name must exist in the providers collection.
deleteAllOperationTimeout  600 Command timeout for the delete all functionality.

The values for the episerver.dataStore section have defaults defined in code equivalent to the following:

<episerver.dataStore>
  <dataStore defaultProvider="EPiServerSQLServerDataStoreProvider">
    <providers>
      <add name="EPiServerSQLServerDataStoreProvider" 
           description="SQL Server implementation of Data Store" 
           type="EPiServer.Data.Dynamic.Providers.SqlServerDataStoreProvider, EPiServer.Data" />
    </providers>
    <cache defaultProvider="httpCacheProvider">
      <providers>
        <add name="httpCacheProvider" 
             description="Http Cache implementation for DataStore" 
             type="EPiServer.Data.Cache.HttpRuntimeCacheProvider,EPiServer.Data.Cache" />
        <add name="nullCacheProvider" 
             description="Null Cache implementation for DataStore"
             type="EPiServer.Data.Cache.NullCacheProvider,EPiServer.Data" />
      </providers>
    </cache>
  </dataStore>
</episerver.dataStore>

If you want to change these defaults, specify the overridden values. The configuration specified in the file is merged with the default in code. As with the Microsoft standard, providers added in the providers element are merged with the defaults. To completely replace the defaults, add the <clear /> element as the first element in the providers collection.

<cache> Element Attributes

Name Default value Description
defaultProvider  httpCacheProvider The name of the default cache provider. A provider with the specified name must exist in the cache/providers collection.

<cache> and <providers> and <add> Element Attributes

The httpCacheProvider (EPiServer.Data.Cache.HttpRuntimeCacheProvider) and nullCacheProvider (EPiServer.Data.Cache.NullCacheProvider) providers are automatically added to the providers collection. To remove one or more of these, use the standard <remove> and <clear> elements.

Name Default value Description
description    Short text describing in the provider.
name    Required. Unique name for this provider.
type    Required. The full name of the data store cache provider class. The referenced class must inherit from EPiServer.Data.Cache.CacheProvider.

<providers> and <add> Element Attributes

The EPiServerSQLServerDataStoreProvider (EPiServer.Data.Dynamic.Providers.SqlServerDataStoreProvider) provider is automatically added to the providers collection. To remove one or more of these, use the standard <remove> and <clear> elements.

Name Default value Description
description    Short text describing in the provider.
name    Required. Unique name for this provider.
type    Required. The full name of the data store provider class. The referenced class must inherit from EPiServer.Data.Dynamic.Providers.DataStoreProvider.

<entity> and <providers> and <add> Element Attributes

Name Default value Description
name    Required. Unique name for this entity provider.
type    Required. The full name of the entity provider class. The referenced class must implement EPiServer.Data.Entity.IEntityProvider.

<entity> and <supported> and <add> Element Attributes

Name Default value Description
Providers    Required. The unique name of the entity provider that should handle this entity class. (As defined in the providers list.)
SupportedTypes    Required. The full name of the entity class to be registered with the specified provider. The referenced class must implement EPiServer.Data.Entity.IEntity.

<dataSettings>

Name Default value Description
connectionStringName  EPiServerDB The identifying name for the connection string that should be used. A connection string with the specified name must exist in the connectionStrings section (ConnectionStrings.config).
databaseQueryTimeout  0:0:30 The timeout value to use for all database queries (in other words DbCommand.CommandTimeOut).
retries  5 The number of retry attempts in case a transient error such as a deadlock occurs or a timeout when opening the connection.
retryDelay  0:0:0.1 The time to wait before retrying in case of a transient error (only relevant if retries is greater than 0). Retry delays are using a exponential backoff based on the delay with a minimum of 10ms and a maximum of 10s.
Do you find this information helpful? Please log in to provide feedback.

Last updated: May 25, 2021

Recommended reading