Configure DDS
Control Dynamic Data Store behavior through configuration settings and programmatic options.
The Dynamic Data Store (DDS) provides configuration options that control type resolution, store remapping, and operation timeouts. Adjust these settings to match your application requirements.
Configure DDS options
Define DynamicDataStoreOptions under EPiServer:Cms in appsettings.json. The following options are available:
-
autoResolveType– Set totrue(default) orfalse.When set to
true, the Dynamic Data Store attempts to resolve .NET types if theSystem.Type.GetTypemethod call fails. The resolution first removes version information from the type string and callsType.GetTypeagain. If that fails, the resolution removes assembly information and callsType.GetTypeagain. If the type still does not resolve, the system throws an exception.When set to
false, type resolution occurs through assembly redirects in the configuration file. -
autoRemapStores– Set totrue(default) orfalse.When set to
true, the Dynamic Data Store automatically remaps all .NET classes decorated with theEPiServerDataStoreAttributeattribute where theAutomaticallyRemapStoreproperty is set totrue. Remapping occurs when the class and store mappings are no longer aligned.When set to
false, no automatic remapping occurs for any class.WarningIn multi-instance environments (such as Azure App Service or load-balanced servers), automatic remapping (
autoRemapStores = truetogether withAutomaticallyRemapStore = trueon a type) can cause transientInvalid column nameerrors during a deployment that adds, removes, or renames properties. See Multi-instance deployment considerations for the cause and recommended mitigations. -
DeleteAllOperationTimeout– The extended command timeout for deleting all items in a store.
{
"EPiServer" : {
"Cms" : {
"DynamicDataStore" : {
"AutoResolveTypes" : "true/false",
"AutoRemapStores" : "true/false",
"DeleteAllOperationTimeout" : "time span"
}
}
}
}Change configuration programmatically
To modify Dynamic Data Store configuration at runtime, use the EPiServer.Data.Dynamic.DynamicDataStoreOptions class. Configure IServiceCollection in the ConfigureServices method of the Startup class during site initialization.
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
Follow these best practices when working with the Dynamic Data Store:
- Create or obtain instances of
DynamicDataStoreon the stack, use them, and then discard them. The Dynamic Data Store is not thread safe. If multiple threads share an instance, protect it with thread-locking techniques. - Implement
EPiServer.Data.IDynamicDataor aGuidproperty calledIdon your objects to control the external identity of stored objects. - Use the same instance of a Dynamic Data Store to load and then update a POCO object (object without identity).
