Back to Devexpress

InMemoryDataStore Class

xpo-devexpress-dot-xpo-dot-db-757fe86b.md

latest2.6 KB
Original Source

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.v25.2.dll

NuGet Package : DevExpress.Xpo

Declaration

csharp
public class InMemoryDataStore :
    DataStoreBase,
    IDataStoreSchemaExplorer,
    IDataStoreSchemaExplorerSp
vb
Public Class InMemoryDataStore
    Inherits DataStoreBase
    Implements 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.

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

XpoDefault.DataLayer = new SimpleDataLayer(new InMemoryDataStore());
vb
Imports DevExpress.Xpo
Imports DevExpress.Xpo.DB

XpoDefault.DataLayer = New SimpleDataLayer(New InMemoryDataStore())

Inheritance

Object MarshalByRefObject DevExpress.Xpo.DB.DataStoreSerializedBase DataStoreBase InMemoryDataStore

See Also

InMemoryDataStore Members

IDataStore

DevExpress.Xpo.DB Namespace