Show / Hide Table of Contents

    Class StateManager<TResource, TEntity>

    The state manager implementation.

    Inheritance
    Object
    StateManager<TResource, TEntity>
    Implements
    IStateManager<TResource>
    ICollection<TResource>
    IEnumerable<TResource>
    IEnumerable
    IDisposable
    Namespace: Microsoft.Graph.Communications.Client
    Assembly: Microsoft.Graph.Communications.Client.dll
    Syntax
    public class StateManager<TResource, TEntity> : Disposable, IStateManager<TResource>, ICollection<TResource>, IEnumerable<TResource>, IEnumerable, IDisposable where TResource : IResource<TResource, TEntity> where TEntity : Entity
    Type Parameters
    Name Description
    TResource

    The type of the resource.

    TEntity

    The type of the entity.

    Constructors

    StateManager(ISerializer, ICache)

    Initializes a new instance of the StateManager<TResource, TEntity> class.

    Declaration
    public StateManager(ISerializer serializer, ICache cache)
    Parameters
    Type Name Description
    ISerializer serializer

    The serializer.

    ICache cache

    The cache.

    Properties

    Count

    Declaration
    public int Count { get; }
    Property Value
    Type Description
    Int32

    IsReadOnly

    Declaration
    public bool IsReadOnly { get; }
    Property Value
    Type Description
    Boolean

    Item[String]

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

    Methods

    Add(TResource)

    Adds an item to the ICollection<T>.

    Declaration
    public void Add(TResource item)
    Parameters
    Type Name Description
    TResource item

    The object to add to the ICollection<T>.

    Exceptions
    Type Condition
    ServiceException

    If the resource already exists in the collection.

    Clear()

    Declaration
    public void Clear()

    Contains(TResource)

    Declaration
    public bool Contains(TResource item)
    Parameters
    Type Name Description
    TResource item
    Returns
    Type Description
    Boolean

    CopyContent()

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

    CopyTo(TResource[], Int32)

    Declaration
    public void CopyTo(TResource[] array, int arrayIndex)
    Parameters
    Type Name Description
    TResource[] array
    Int32 arrayIndex

    Dispose(Boolean)

    Declaration
    protected override void Dispose(bool disposing)
    Parameters
    Type Name Description
    Boolean disposing

    GetEnumerator()

    Declaration
    public IEnumerator<TResource> GetEnumerator()
    Returns
    Type Description
    IEnumerator<TResource>

    GetOrAdd(String, Func<TResource>)

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

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

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

    Remove(TResource)

    Removes the occurrence of a specific object from the IStateManager<TResource>.

    Declaration
    public bool Remove(TResource item)
    Parameters
    Type Name Description
    TResource item

    The object to remove from the IStateManager<TResource>.

    Returns
    Type Description
    Boolean

    true if item was successfully removed from the IStateManager<TResource>.

    Exceptions
    Type Condition
    ServiceException

    If the resource does not exist in the collection.

    Remove(String)

    Removes the occurrence of a specific object from the IStateManager<TResource>.

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

    The identifier of the object to remove from the IStateManager<TResource>.

    Returns
    Type Description
    TResource

    The IResource that was removed.

    Exceptions
    Type Condition
    ServiceException

    If the resource does not exist in the collection.

    TryRemove(String, out TResource)

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

    Explicit Interface Implementations

    IEnumerable.GetEnumerator()

    Declaration
    IEnumerator IEnumerable.GetEnumerator()
    Returns
    Type Description
    IEnumerator

    Implements

    IStateManager<TResource>
    System.Collections.Generic.ICollection<T>
    System.Collections.Generic.IEnumerable<T>
    System.Collections.IEnumerable
    System.IDisposable

    See Also

    IStateManager<TResource>
    Back to top Copyright (c) Microsoft Corporation. All rights reserved.