Edit

Share via


UserExtensionStorageHelper Class

Definition

An ISettingsStorageHelper implementation using open extensions on the Graph User for storing key/value pairs.

public class UserExtensionStorageHelper : Microsoft.Toolkit.Helpers.ISettingsStorageHelper<string>
type UserExtensionStorageHelper = class
    interface ISettingsStorageHelper<string>
Public Class UserExtensionStorageHelper
Implements ISettingsStorageHelper(Of String)
Inheritance
UserExtensionStorageHelper
Implements

Constructors

UserExtensionStorageHelper(String, String, IObjectSerializer)

Initializes a new instance of the UserExtensionStorageHelper class.

Properties

Cache

Gets a cache of the stored values, converted using the provided serializer.

ExtensionId

Gets the id for the target extension on a Graph user.

Item[String]

An indexer for easily accessing key values.

Serializer

Gets an object serializer for converting objects in the data store.

SyncCompleted

Gets or sets an event that fires whenever a sync request has completed.

SyncFailed

Gets or sets an event that fires whenever a remote sync request has failed.

UserId

Gets the id of the target Graph user.

Methods

Clear()

Clear all keys and values from the settings store.

CreateForCurrentUserAsync(String, IObjectSerializer)

Creates a new instance using the userId retrieved from a Graph "Me" request.

DeserializeValue<T>(Object)

Use the serializer to deserialize a value appropriately for the type.

GetGraphClient()

Retrieve an instance of the GraphServiceClient, or throws an exception if not signed in.

Save<T>(String, T)

Saves a single item by its key.

SerializeValue<T>(T)

Use the serializer to serialize a value appropriately for the type.

Sync()

Synchronize the cache with the remote:

  • If the cache has been cleared, the remote will be deleted and recreated.
  • Any cached keys will be saved to the remote, overwriting existing values.
  • Any new keys from the remote will be stored in the cache.
TryDelete(String)

Deletes a single item by its key.

TryRead<TValue>(String, TValue)

Retrieves a single item by its key.

Extension Methods

Delete<TKey>(ISettingsStorageHelper<TKey>, TKey)

Deletes a key from storage.

GetValueOrDefault<TKey,TValue>(ISettingsStorageHelper<TKey>, TKey, TValue)

Attempts to read the provided key and return the value. If the key is not found, the fallback value will be used instead.

Read<TKey,TValue>(ISettingsStorageHelper<TKey>, TKey)

Read the key in the storage helper instance and get the value.

Applies to