Content-Length: 21807 | pFad | https://googleapis.dev/dotnet/Google.Apis/latest/api/Google.Apis.Util.Store.FileDataStore.html

 Class FileDataStore | Google API support libraries
Show / Hide Table of Contents

Class FileDataStore

File data store that implements Google.Apis.Util.Store.IDataStore. This store creates a different file for each combination of type and key. This file data store stores a JSON format of the specified object.

Inheritance
object
FileDataStore
Implements
IDataStore
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: Google.Apis.Util.Store
Assembly: Google.Apis.dll
Syntax
public class FileDataStore : IDataStore

Constructors

FileDataStore(string, bool)

Constructs a new file data store. If fullPath is false the path will be used as relative to Environment.SpecialFolder.ApplicationData" on Windows, or $HOME on Linux and MacOS, otherwise the input folder will be treated as absolute. The folder is created if it doesn't exist yet.

Declaration
public FileDataStore(string folder, bool fullPath = false)
Parameters
Type Name Description
string folder

Folder path.

bool fullPath

Defines whether the folder parameter is absolute or relative to Environment.SpecialFolder.ApplicationData on Windows, or$HOME on Linux and MacOS.

Properties

FolderPath

Gets the full folder path.

Declaration
public string FolderPath { get; }
Property Value
Type Description
string

Methods

ClearAsync()

Clears all values in the data store. This method deletes all files in FolderPath.

Declaration
public Task ClearAsync()
Returns
Type Description
Task

DeleteAsync<T>(string)

Deletes the given key. It deletes the GenerateStoredKey(string, Type) named file in FolderPath.

Declaration
public Task DeleteAsync<T>(string key)
Parameters
Type Name Description
string key

The key to delete from the data store.

Returns
Type Description
Task
Type Parameters
Name Description
T

GenerateStoredKey(string, Type)

Creates a unique stored key based on the key and the class type.

Declaration
public static string GenerateStoredKey(string key, Type t)
Parameters
Type Name Description
string key

The object key.

Type t

The type to store or retrieve.

Returns
Type Description
string

GetAsync<T>(string)

Returns the stored value for the given key or null if the matching file (GenerateStoredKey(string, Type) in FolderPath doesn't exist.

Declaration
public Task<T> GetAsync<T>(string key)
Parameters
Type Name Description
string key

The key to retrieve from the data store.

Returns
Type Description
Task<T>

The stored object.

Type Parameters
Name Description
T

The type to retrieve.

StoreAsync<T>(string, T)

Stores the given value for the given key. It creates a new file (named GenerateStoredKey(string, Type)) in FolderPath.

Declaration
public Task StoreAsync<T>(string key, T value)
Parameters
Type Name Description
string key

The key.

T value

The value to store in the data store.

Returns
Type Description
Task
Type Parameters
Name Description
T

The type to store in the data store.

Implements

Google.Apis.Util.Store.IDataStore
In this article
Back to top Generated by DocFX








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://googleapis.dev/dotnet/Google.Apis/latest/api/Google.Apis.Util.Store.FileDataStore.html

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy