Class StateManager<TResource, TEntity>
The state manager implementation.
Inheritance
StateManager<TResource, TEntity>
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)
Declaration
public StateManager(ISerializer serializer, ICache cache)
Parameters
Properties
Count
Declaration
public int Count { get; }
Property Value
IsReadOnly
Declaration
public bool IsReadOnly { get; }
Property Value
Item[String]
Declaration
public TResource this[string id] { get; }
Parameters
Type |
Name |
Description |
String |
id |
|
Property Value
Type |
Description |
TResource |
|
Methods
Add(TResource)
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
Contains(TResource)
Declaration
public bool Contains(TResource item)
Parameters
Type |
Name |
Description |
TResource |
item |
|
Returns
CopyContent()
Declaration
public ICollection<TResource> CopyContent()
Returns
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
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
Returns
Type |
Description |
Task<TResource> |
|
Remove(TResource)
Declaration
public bool Remove(TResource item)
Parameters
Returns
Exceptions
Type |
Condition |
ServiceException |
If the resource does not exist in the collection.
|
Remove(String)
Declaration
public TResource Remove(string id)
Parameters
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
Explicit Interface Implementations
IEnumerable.GetEnumerator()
Declaration
IEnumerator IEnumerable.GetEnumerator()
Returns
Implements
See Also