Show / Hide Table of Contents

Class ConnectionScope<TKey, TClient>

Auto reserves clients and manages their lifetime.

Inheritance
object
ClientScopeBase<TKey>
ConnectionScope<TKey, TClient>
Implements
IEnumerable<TKey>
IEnumerable
IConnectionScope<TKey, TClient>
IConnectionScope<TKey>
ICanConnect<TKey>
IHoldsBaggage<TKey>
IAsyncDisposable
IDisposable
Inherited Members
ClientScopeBase<TKey>.ConnectAsync(IEnumerable<TKey>, CancellationOptions?)
ClientScopeBase<TKey>.GetAllBaggage<TBaggage>()
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: Microsoft.XboxStudios.ClientManager
Assembly: ClientManager.dll
Syntax
public class ConnectionScope<TKey, TClient> : ClientScopeBase<TKey>, IEnumerable<TKey>, IEnumerable, IConnectionScope<TKey, TClient>, IConnectionScope<TKey>, ICanConnect<TKey>, IHoldsBaggage<TKey>, IAsyncDisposable, IDisposable where TKey : notnull where TClient : class
Type Parameters
Name Description
TKey

The type of key to use.

TClient

The type of client to use.

Remarks

Initializes a new instance of the ConnectionScope<TKey, TClient> class.

Constructors

View Source

ConnectionScope(IClientManager<TKey, TClient>)

Auto reserves clients and manages their lifetime.

Declaration
public ConnectionScope(IClientManager<TKey, TClient> clientManager)
Parameters
Type Name Description
IClientManager<TKey, TClient> clientManager

The client manager used to establish connections.

Remarks

Initializes a new instance of the ConnectionScope<TKey, TClient> class.

Methods

View Source

ConnectAndGetBaggageAsync<TBaggage>(TKey, CancellationOptions?)

Connects if necessary and gets the baggage associated with a key.

Declaration
public virtual ValueTask<TBaggage> ConnectAndGetBaggageAsync<TBaggage>(TKey key, CancellationOptions? co = null)
Parameters
Type Name Description
TKey key

The TKey to use to fetch a baggage.

CancellationOptions? co

The Microsoft.XboxStudios.Bifrost.CancellationOptions.

Returns
Type Description
ValueTask<TBaggage>

The baggage if possible.

Type Parameters
Name Description
TBaggage

The type of the baggage.

Exceptions
Type Condition
BaggageNullException

Thrown if the registered baggage factory returned null.

ConnectionFailedException

Thrown if the connection could not be established.

MissingBaggageFactoryException

Thrown if the baggage factory of the requested baggage is not registered.

View Source

ConnectAndGetClientAsync(TKey, CancellationOptions?)

Connects if necessary and gets the client associated with a key.

Declaration
public ValueTask<TClient?> ConnectAndGetClientAsync(TKey key, CancellationOptions? co = null)
Parameters
Type Name Description
TKey key

The TKey to use to fetch a baggage.

CancellationOptions? co

The Microsoft.XboxStudios.Bifrost.CancellationOptions.

Returns
Type Description
ValueTask<TClient>

The client if possible, null otherwise.

View Source

ConnectAsync(TKey, CancellationOptions?)

Connects a client to a game instance.

Declaration
public override ValueTask<bool> ConnectAsync(TKey key, CancellationOptions? co = null)
Parameters
Type Name Description
TKey key

The TKey to use to fetch a client and attempt a connection.

CancellationOptions? co

The Microsoft.XboxStudios.Bifrost.CancellationOptions.

Returns
Type Description
ValueTask<bool>

A value indicating whether connection was successful or not.

Overrides
ClientScopeBase<TKey>.ConnectAsync(TKey, CancellationOptions?)
View Source

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

Declaration
public void Dispose()
View Source

DisposeAsync()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources asynchronously.

Declaration
public ValueTask DisposeAsync()
Returns
Type Description
ValueTask

A task that represents the asynchronous dispose operation.

View Source

GetBaggage<TBaggage>(TKey)

Gets the baggage associated with a key.

Declaration
public override TBaggage GetBaggage<TBaggage>(TKey key)
Parameters
Type Name Description
TKey key

The TKey to use to fetch a baggage.

Returns
Type Description
TBaggage

The baggage or null if no connection exists.

Type Parameters
Name Description
TBaggage

The type of the baggage.

Overrides
ClientScopeBase<TKey>.GetBaggage<TBaggage>(TKey)
Exceptions
Type Condition
BaggageNullException

Thrown if the registered baggage factory returned null.

MissingBaggageFactoryException

Thrown if the baggage factory of the requested baggage is not registered.

View Source

GetEnumerator()

Returns an enumerator that iterates through the collection.

Declaration
public override IEnumerator<TKey> GetEnumerator()
Returns
Type Description
IEnumerator<TKey>

An enumerator that can be used to iterate through the collection.

Overrides
ClientScopeBase<TKey>.GetEnumerator()
View Source

RemoveConnection(TKey)

Removes the connection associated with the key if active.

Declaration
public void RemoveConnection(TKey key)
Parameters
Type Name Description
TKey key

The key to remove the state for.

Implements

IEnumerable<T>
IEnumerable
IConnectionScope<TKey, TClient>
IConnectionScope<TKey>
ICanConnect<TKey>
IHoldsBaggage<TKey>
IAsyncDisposable
IDisposable
  • View Source
In this article
Back to top Generated by DocFX