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.GetTyp
`e 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.
## 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.
## 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).