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

Configuring Dynamic Data Store

Recommended reading 
Note: This documentation is for the preview version of the upcoming release of CMS 12/Commerce 14/Search & Navigation 14. Features included here might not be complete, and might be changed before becoming available in the public release. This documentation is provided for evaluation purposes only.

You have the following options to configure through the application’s configuration file:

The DynamicDataStoreOptions can be defined under EPiServer:Cms

  • The DynamicDataStoreOptions element has the child elements  AutoResolveTypes, AutoRemapStores and DeleteAllOperationTimeout and the following attributes:
    • autoResolveType can be true (default) or false.

      If set to true then the Dynamic Data Store tries to resolve .NET Types if the System.Type.GetType method call fails for types stored in a store. The resolution occurs by removing the version information from the type string and calling Type.GetType again. If this fails, the resolution occurs by removing the assembly information from the type string and calling Type.GetType again. If the Type still is not resolved, an exception is thrown.

      If set to false, type resolving occurs through assembly redirects in the configuration file.

    • autoRemapStores can be true (default) or false.

      If set to true, then the Dynamic Data Store automatically remaps all .NET classes decorated with the EPiServerDataStoreAttribute attribute and where the AutomaticallyRemapStore property is set to true, to their respective stores when the Class and store mappings are no longer aligned.

      If set to false, no automatic remapping is done for any class.

    • DeleteAllOperationTimeout The extended command timeout to use when deleting all items in a store.
{
  "EPiServer" : {
    "Cms" : {
       "DynamicDataStore" : {
           "AutoResolveTypes"          : "true/false",
           "AutoRemapStores"           : "true/false",
           "DeleteAllOperationTimeout" : "time span"
       }
    }
  }
}

Change configuration programmatically

You can modify some of the Dynamic Data Store configuration programmatically through the EPiServer.Data.Dynamic.DynamicDataStoreOptions class. You should do this during the configuration phase of the site initialization, by configuring IServiceCollection in the ConfigureServices method in the Startup class.

public class Startup
{
  public void ConfigureServices(IServiceCollection services)
  {
    . . .

    services.Configure<DynamicDataStoreOptions>(options =>
    {
      options.AutoRemapStores = true or false;
      options.AutoResolveTypes = true or false ;
      options.DeleteAllOperationTimeout = TimeSpan.FromSeconds(xxx);
    });

    . . .
  }
}

Recommendations

  • Create/obtain instances of the DynamicDataStore on the stack, use them and then discard them. Note that the Dynamic Data Store is not thread safe and if an instance is used and shared between multiple threads, it should be protected with thread-locking techniques.
  • Implement EPiServer.Data.IDynamicData or a Guid property called Id on your objects to be saved when you want to control the external identity of your objects.
  • Use the same instance of a Dynamic Data Store to load and then update a POCO object (object without identity).

Related topics

Do you find this information helpful? Please log in to provide feedback.

Last updated: Jul 02, 2021

Recommended reading