Interface IDataStoreProvider
Interface for classes that can save a string to a data store. Loads and saves asynchronously, and understands the concept of paths.
Namespace: Microsoft.Internal.Studios.Aruba.Infrastructure
Assembly: Aruba.Infrastructure.dll
Syntax
public interface IDataStoreProvider
Methods
View SourceDeleteAsync<T>(T)
Delete the object from the data store.
Declaration
Task DeleteAsync<T>(T dataToDelete) where T : class, new()
Parameters
Type | Name | Description |
---|---|---|
T | dataToDelete | The object to be deleted. |
Returns
Type | Description |
---|---|
Task | The task. |
Type Parameters
Name | Description |
---|---|
T | The type of object to delete. |
DeleteFileAsync(string)
Deletes the specific file in the data store.
Declaration
Task DeleteFileAsync(string fileName)
Parameters
Type | Name | Description |
---|---|---|
string | fileName | The file to delete. |
Returns
Type | Description |
---|---|
Task | The task. |
GetUserAccessLevel()
Get the access level of the user for the given store provider.
Declaration
Task<AccessLevel> GetUserAccessLevel()
Returns
Type | Description |
---|---|
Task<AccessLevel> | The AccessLevel of the user. |
InitializeAsync()
Initializes the data provider.
Declaration
Task InitializeAsync()
Returns
Type | Description |
---|---|
Task | A task representing the work to connect initialize the data provider. |
LoadAllAsync<T>(bool, bool)
Loads all of the requested T objects into a list from the data store.
Declaration
Task<IEnumerable<T>> LoadAllAsync<T>(bool forceReload = false, bool updateCache = true) where T : class, new()
Parameters
Type | Name | Description |
---|---|---|
bool | forceReload | Forces data to be reloaded from the original source regardless if the cache already has data. |
bool | updateCache | Flag to update the cache or not. |
Returns
Type | Description |
---|---|
Task<IEnumerable<T>> | A list of all loaded objects of type |
Type Parameters
Name | Description |
---|---|
T | The type of objects to load. |
LoadAsync<T>(string?, bool, bool)
Loads the named object of the given type from the store.
Declaration
Task<T?> LoadAsync<T>(string? name = null, bool forceReload = false, bool updateCache = true) where T : class, new()
Parameters
Type | Name | Description |
---|---|---|
string | name | Optional name of the object in the store if needed. |
bool | forceReload | Forces data to be reloaded from the original source regardless if the cache already has data. |
bool | updateCache | Flag to update the cache or not. |
Returns
Type | Description |
---|---|
Task<T> | The loaded object if found or null if not found. |
Type Parameters
Name | Description |
---|---|
T | The type of object to load. |
Exceptions
Type | Condition |
---|---|
DataStoreAccessFailedException | Thrown when loading data fails due to unexpected issues such as access or connectivity. |
LoadFileAsync<T>(string?)
Loads the path as the given generic type.
Declaration
Task<T?> LoadFileAsync<T>(string? filePath = null) where T : class, new()
Parameters
Type | Name | Description |
---|---|---|
string | filePath | The path to load the file from. |
Returns
Type | Description |
---|---|
Task<T> | The loaded object if found or null if not found. |
Type Parameters
Name | Description |
---|---|
T | The type of object to load. |
SaveAsync<T>(T, bool, string)
Save the given object to the store.
Declaration
Task SaveAsync<T>(T dataToSave, bool overwriteExisting = true, string overridePath = "") where T : class, new()
Parameters
Type | Name | Description |
---|---|---|
T | dataToSave | The data to save. |
bool | overwriteExisting | Optional parameter to overwrite any existing object. Defaults to true. |
string | overridePath | Optional parameter to override the file path. Defaults to "". |
Returns
Type | Description |
---|---|
Task | The task. |
Type Parameters
Name | Description |
---|---|
T | The type of the data to save. |
Exceptions
Type | Condition |
---|---|
ObjectExistsException | Thrown when the object exists already and overwriteExisting is false. |