Show / Hide Table of Contents

    Interface IStateManager<TResource>

    The state manager interface. This object is responsible for storing the resources in memory.

    Inherited Members
    ICollection<TResource>.Add(TResource)
    ICollection<TResource>.Clear()
    ICollection<TResource>.Contains(TResource)
    ICollection<TResource>.CopyTo(TResource[], Int32)
    ICollection<TResource>.Remove(TResource)
    ICollection<TResource>.Count
    ICollection<TResource>.IsReadOnly
    IEnumerable<TResource>.GetEnumerator()
    IDisposable.Dispose()
    Namespace: Microsoft.Graph.Communications.Client
    Assembly: Microsoft.Graph.Communications.Client.dll
    Syntax
    public interface IStateManager<TResource> : ICollection<TResource>, IEnumerable<TResource>, IEnumerable, IDisposable where TResource : IResource
    Type Parameters
    Name Description
    TResource

    The type of the resource.

    Properties

    Item[String]

    Gets the IResource<TSelf, TEntity> with the specified identifier.

    Declaration
    TResource this[string id] { get; }
    Parameters
    Type Name Description
    String id

    The identifier.

    Property Value
    Type Description
    TResource

    The IResource<TSelf, TEntity>.

    Methods

    CopyContent()

    Copies the content contained by this instance.

    Declaration
    ICollection<TResource> CopyContent()
    Returns
    Type Description
    ICollection<TResource>

    The copied ICollection<T>

    GetOrAdd(String, Func<TResource>)

    Gets the resource with the specified id if it exists in the collection, otherwise executes the resource factory to create the resource. State manager does not guarantee that the resource factory is executed only once, so operations must be idempotent (I.E. GET, PUT, etc...).

    Declaration
    TResource GetOrAdd(string id, Func<TResource> resourceFactory)
    Parameters
    Type Name Description
    String id

    The identifier.

    Func<TResource> resourceFactory

    The resource factory.

    Returns
    Type Description
    TResource

    The IResource<TSelf, TEntity> that was found or created.

    GetOrAddAsync(String, Func<Task<TResource>>)

    Gets the resource with the specified id if it exists in the collection, otherwise executes the resource factory to create the resource. State manager does not guarantee that the resource factory is executed only once, so operations must be idempotent (I.E. GET, PUT, etc...). This method supports asynchronously creating the resource.

    Declaration
    Task<TResource> GetOrAddAsync(string id, Func<Task<TResource>> resourceFactory)
    Parameters
    Type Name Description
    String id

    The identifier.

    Func<Task<TResource>> resourceFactory

    The resource factory.

    Returns
    Type Description
    Task<TResource>

    The IResource<TSelf, TEntity> that was found or created.

    Remove(String)

    Removes the resource with the specified id from the state manager.

    Declaration
    TResource Remove(string id)
    Parameters
    Type Name Description
    String id

    The identifier.

    Returns
    Type Description
    TResource

    The IResource<TSelf, TEntity> that was removed.

    TryRemove(String, out TResource)

    Tries to remove the resource with the specified id.

    Declaration
    bool TryRemove(string id, out TResource resource)
    Parameters
    Type Name Description
    String id

    The identifier.

    TResource resource

    The resource.

    Returns
    Type Description
    Boolean

    true if the IResource<TSelf, TEntity> was removed, false otherwise.

    Back to top Copyright (c) Microsoft Corporation. All rights reserved.