Google API Client Library for .NET  1.10.0
Public Member Functions | Static Public Member Functions | Properties | List of all members
Google.Apis.Util.Store.FileDataStore Class Reference

File data store that implements 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. More...

Inheritance diagram for Google.Apis.Util.Store.FileDataStore:
Google.Apis.Util.Store.IDataStore

Public Member Functions

 FileDataStore (string folder, bool fullPath=false)
 Constructs a new file data store. If fullPath is false the path will be used as relative to Environment.SpecialFolder.ApplicationData, otherwise the input folder will be treated as absolute. The folder is created if it doesn't exist yet. More...
 
Task StoreAsync< T > (string key, T value)
 Stores the given value for the given key. It creates a new file (named GenerateStoredKey) in FolderPath. More...
 
Task DeleteAsync< T > (string key)
 Deletes the given key. It deletes the GenerateStoredKey named file in FolderPath. More...
 
Task< T > GetAsync< T > (string key)
 Returns the stored value for the given key or null if the matching file (GenerateStoredKey in FolderPath doesn't exist. More...
 
Task ClearAsync ()
 Clears all values in the data store. This method deletes all files in FolderPath. More...
 

Static Public Member Functions

static string GenerateStoredKey (string key, Type t)
 Creates a unique stored key based on the key and the class type. More...
 

Properties

string FolderPath [get]
 Gets the full folder path. More...
 

Detailed Description

File data store that implements 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.

Constructor & Destructor Documentation

Google.Apis.Util.Store.FileDataStore.FileDataStore ( string  folder,
bool  fullPath = false 
)
inline

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

Parameters
folderFolder path.
fullPathDefines weather the folder parameter is absolute or relative to Environment.SpecialFolder.ApplicationData.

Member Function Documentation

Task Google.Apis.Util.Store.FileDataStore.ClearAsync ( )
inline

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

Implements Google.Apis.Util.Store.IDataStore.

Task Google.Apis.Util.Store.FileDataStore.DeleteAsync< T > ( string  key)
inline

Deletes the given key. It deletes the GenerateStoredKey named file in FolderPath.

Parameters
keyThe key to delete from the data store.

Implements Google.Apis.Util.Store.IDataStore.

static string Google.Apis.Util.Store.FileDataStore.GenerateStoredKey ( string  key,
Type  t 
)
inlinestatic

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

Parameters
keyThe object key.
tThe type to store or retrieve.
Task<T> Google.Apis.Util.Store.FileDataStore.GetAsync< T > ( string  key)
inline

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

Template Parameters
TThe type to retrieve.
Parameters
keyThe key to retrieve from the data store.
Returns
The stored object.

Implements Google.Apis.Util.Store.IDataStore.

Task Google.Apis.Util.Store.FileDataStore.StoreAsync< T > ( string  key,
value 
)
inline

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

Template Parameters
TThe type to store in the data store.
Parameters
keyThe key.
valueThe value to store in the data store.

Implements Google.Apis.Util.Store.IDataStore.

Property Documentation

string Google.Apis.Util.Store.FileDataStore.FolderPath
get

Gets the full folder path.


The documentation for this class was generated from the following file: