Class PersistenceProvider<TSossObject>
- Namespace
- Scaleout.Modules.Abstractions
- Assembly
- Scaleout.Modules.Abstractions.dll
Base class for persistence providers.
public abstract class PersistenceProvider<TSossObject>
Type Parameters
TSossObject
- Inheritance
-
PersistenceProvider<TSossObject>
- Inherited Members
Constructors
PersistenceProvider(string)
Initializes a new instance of the PersistenceProvider class.
protected PersistenceProvider(string moduleName)
Parameters
moduleName
stringName of the module for which persistence storage is being used.
Properties
ModuleName
Name of the module for which persistence storage is being used.
protected string ModuleName { get; }
Property Value
Methods
DeleteAsync(string)
Deletes the instance from persistent storage.
public abstract Task DeleteAsync(string instanceId)
Parameters
instanceId
stringUnique identifier of the object in the ScaleOut StateServer service.
Returns
- Task
Task representing the async operation.
InitializeAsync()
Initializes provider and establishes connection to the associated service.
public abstract Task InitializeAsync()
Returns
- Task
Task representing the async operation
LoadAsync(string)
Loads the data from a persistent storage.
public abstract Task<TSossObject?> LoadAsync(string instanceId)
Parameters
instanceId
stringUnique identifier of the object in the ScaleOut StateServer service.
Returns
- Task<TSossObject>
The object that was retrieved from the persistence provider, or null if the object does not exist in the persistent storage.
SaveAsync(string, TSossObject)
Serializes and saves the instance to persistent storage.
public abstract Task SaveAsync(string instanceId, TSossObject sossObject)
Parameters
instanceId
stringUnique identifier of the object in the ScaleOut StateServer service.
sossObject
TSossObjectInstance to save.
Returns
- Task
Task representing the async operation