Skip to main content

InMemoryDataStore Class

Stores persistent objects in memory. Intended for a testing environment and not for production purposes or large data sets.

Namespace: DevExpress.Xpo.DB

Assembly: DevExpress.Xpo.v24.1.dll

NuGet Package: DevExpress.Xpo

Declaration

public class InMemoryDataStore :
    DataStoreBase,
    IDataStoreSchemaExplorer,
    IDataStoreSchemaExplorerSp

Remarks

Important

We do not recommend that you use the ReadXml and WriteXml methods due to potential vulnerabilities if the input XML document contains names of untrusted assemblies and types. Validate or sanitize the input XML documents even in testing and non-production environments for the best security.

When a Session object uses the functionality of the InMemoryDataStore class, persistent objects are stored and loaded from RAM.

Example

This example demonstrates how to store persistent objects in RAM.

To use RAM as a data store, a InMemoryDataStore object is created and passed to the SimpleDataLayer object constructor. The created SimpleDataLayer object is assigned to the XpoDefault.DataLayer property and will be used by any Session object when a connection to a data store is to be established.

using DevExpress.Xpo;
using DevExpress.Xpo.DB;

XpoDefault.DataLayer = new SimpleDataLayer(new InMemoryDataStore());

Inheritance

Object
MarshalByRefObject
DevExpress.Xpo.DB.DataStoreSerializedBase
DataStoreBase
InMemoryDataStore
See Also