Class ConnectionPurposeScope

Namespace
Cratis.Arc.Connections
Assembly
Cratis.Arc.Core.dll

Represents the ambient ConnectionPurpose for connections opened on the current execution flow.

public static class ConnectionPurposeScope
Inheritance
ConnectionPurposeScope
Inherited Members

Remarks

Connections are opened for Runtime unless a scope says otherwise. Wrap schema changes to have them resolved for Schema:

using (ConnectionPurposeScope.Begin(ConnectionPurpose.Schema))
{
    await dbContext.Database.MigrateAsync();
}

Properties

Current

Gets the ConnectionPurpose for the current execution flow.

public static ConnectionPurpose Current { get; }

Property Value

ConnectionPurpose

Methods

Begin(ConnectionPurpose)

Begin a scope where connections are opened for a purpose.

public static IDisposable Begin(ConnectionPurpose purpose)

Parameters

purpose ConnectionPurpose

The ConnectionPurpose.

Returns

IDisposable

An IDisposable that restores the previous purpose when disposed.