Show / Hide Table of Contents

Class FileDataStoreProvider

An implementation of IDataStoreProvider that uses the file system.

Inheritance
object
FileDataStoreProvider
Implements
IDataStoreProvider
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: Microsoft.Internal.Studios.Aruba.Infrastructure
Assembly: Aruba.Infrastructure.dll
Syntax
public class FileDataStoreProvider : IDataStoreProvider

Constructors

View Source

FileDataStoreProvider(string, IObjectTextSerializer?)

Initializes a new instance of the FileDataStoreProvider class.

Declaration
public FileDataStoreProvider(string directory, IObjectTextSerializer? objectTextSerializer = null)
Parameters
Type Name Description
string directory

The directory to store data.

IObjectTextSerializer objectTextSerializer

The optional IObjectTextSerializer to use. XmlObjectTextSerializer is used if null.

View Source

FileDataStoreProvider(string, bool, IObjectTextSerializer?)

Initializes a new instance of the FileDataStoreProvider class.

Declaration
public FileDataStoreProvider(string titleName, bool userData, IObjectTextSerializer? objectTextSerializer = null)
Parameters
Type Name Description
string titleName

The name of the title.

bool userData

Set to true for the user store, false for the title store.

IObjectTextSerializer objectTextSerializer

The optional IObjectTextSerializer to use. XmlObjectTextSerializer is used if null.

Methods

View Source

DeleteAsync<T>(T)

Delete the object from the data store.

Declaration
public 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.

View Source

DeleteFileAsync(string)

Deletes the specific file in the data store.

Declaration
public Task DeleteFileAsync(string fileName)
Parameters
Type Name Description
string fileName

The file to delete.

Returns
Type Description
Task

The task.

View Source

GetUserAccessLevel()

Gets the AccessLevel of the current user.

Declaration
public Task<AccessLevel> GetUserAccessLevel()
Returns
Type Description
Task<AccessLevel>

The users AccessLevel.

Remarks

The FileDataStoreProvider should only be used when a developer is doing work with templates (see ArubaPlugin.cs), tokens or layouts that they do not want saved to Roster, so it is safe to give users administrator access.

View Source

InitializeAsync()

Initializes the data provider.

Declaration
public Task InitializeAsync()
Returns
Type Description
Task

A task representing the work to connect initialize the data provider.

View Source

LoadAllAsync<T>(bool, bool)

Loads all of the requested T objects into a list from the data store.

Declaration
public 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 T.

Type Parameters
Name Description
T

The type of objects to load.

Remarks

Does not use forceReload or updateCache.

View Source

LoadAsync<T>(string?, bool, bool)

Loads the named object of the given type from the store.

Declaration
public 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.

Remarks

Does not use forceReload or updateCache.

Exceptions
Type Condition
DataStoreAccessFailedException

Thrown when loading data fails due to unexpected issues such as access or connectivity.

View Source

LoadFileAsync<T>(string?)

Loads the path as the given generic type.

Declaration
public Task<T?> LoadFileAsync<T>(string? filePath) 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.

View Source

SaveAsync<T>(T, bool, string)

Save the given object to the store.

Declaration
public 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.

Implements

IDataStoreProvider
  • View Source
In this article
Back to top Generated by DocFX