Skip to content

DovetailContextExtensions Methods

ClassMethods18 members
Base convention extensions
Set key to the value if the type is missing
public static class DovetailContextExtensions
{
public static IDovetailContext AddIfMissing<T>(
this IDovetailContext context,
T value)
{
// ...
}
}
contextIDovetailContextThe context
valueTThe value to save
IDovetailContextThe context, for chaining.
ArgumentNullExceptioncontext is null.
AddIfMissing(IDovetailContext, Type, object)Section titled AddIfMissing(IDovetailContext, Type, object)extensionIDovetailContext
Set key to the value if the key is missing
public static class DovetailContextExtensions
{
public static IDovetailContext AddIfMissing(
this IDovetailContext context,
Type key,
object value)
{
// ...
}
}
contextIDovetailContextThe properties
keyTypeThe key where the value is saved
valueobjectThe value to save
IDovetailContextThe context, for chaining.
ArgumentNullExceptioncontext is null.
AddIfMissing(IDovetailContext, string, T)Section titled AddIfMissing(IDovetailContext, string, T)extensionIDovetailContext
Set key to the value if the key is missing
public static class DovetailContextExtensions
{
public static IDovetailContext AddIfMissing<T>(
this IDovetailContext context,
string key,
T value)
{
// ...
}
}
contextIDovetailContextThe properties
keystringThe key where the value is saved
valueTThe value to save
IDovetailContextThe context, for chaining.
ArgumentNullExceptioncontext is null.
Get(IDovetailContext)Section titled Get(IDovetailContext)extensionnullableT?
Get a value by type from the context
public static class DovetailContextExtensions
{
public static T? Get<T>(
this IDovetailContext context)
{
// ...
}
}
contextIDovetailContextThe context
T?T.
ArgumentNullExceptioncontext is null.
Get(IDovetailContext, string)Section titled Get(IDovetailContext, string)extensionnullableT?
Get a value by key from the context
public static class DovetailContextExtensions
{
public static T? Get<T>(
this IDovetailContext context,
string key)
{
// ...
}
}
contextIDovetailContextThe context
keystringThe key where the value is saved
T?T.
ArgumentNullExceptioncontext is null.
Get the host type the context is currently running under
public static class DovetailContextExtensions
{
public static DovetailHostType GetHostType(
this IDovetailContext context)
{
// ...
}
}
contextIDovetailContextThe context
DovetailHostTypeThe DovetailHostType for the context, or DovetailHostType.Undefined if none was registered.
ArgumentNullExceptioncontext is null.
GetOrAdd(IDovetailContext, Func<T>)Section titled GetOrAdd(IDovetailContext, Func<T>)extensionT
Get a value by key from the context
public static class DovetailContextExtensions
{
public static T GetOrAdd<T>(
this IDovetailContext context,
Func<T> factory)
{
// ...
}
}
contextIDovetailContextThe context
factoryFunc<T>The factory method in the event the type is not found
TT.
ArgumentNullExceptioncontext or factory is null.
GetOrAdd(IDovetailContext, string, Func<T>)Section titled GetOrAdd(IDovetailContext, string, Func<T>)extensionT
Get a value by key from the context
public static class DovetailContextExtensions
{
public static T GetOrAdd<T>(
this IDovetailContext context,
string key,
Func<T> factory)
{
// ...
}
}
contextIDovetailContextThe context
keystringThe key where the value is saved
factoryFunc<T>The factory method in the event the type is not found
TT.
ArgumentNullExceptioncontext or factory is null.
IsUnitTestHost(IDovetailContext)Section titled IsUnitTestHost(IDovetailContext)extensionbool
Check if this is a test host (to allow conventions to behave differently during unit tests)
public static class DovetailContextExtensions
{
public static bool IsUnitTestHost(
this IDovetailContext context)
{
// ...
}
}
contextIDovetailContextThe context
booltrue if context is running under DovetailHostType.UnitTest; otherwise, false.
ArgumentNullExceptioncontext is null.
RegisterJoints(IDovetailContext, Action<DovetailExecutor>)Section titled RegisterJoints(IDovetailContext, Action<DovetailExecutor>)extension
Register a set of conventions
public static class DovetailContextExtensions
{
public static void RegisterJoints(
this IDovetailContext context,
Action<DovetailExecutor> configure)
{
// ...
}
}
contextIDovetailContextThe context to execute the conventions against.
configureAction<DovetailExecutor>A callback used to configure which joints the DovetailExecutor should execute.
ArgumentNullExceptioncontext or configure is null.
RegisterJointsAsync(IDovetailContext, Action<DovetailExecutor>, CancellationToken)Section titled RegisterJointsAsync(IDovetailContext, Action<DovetailExecutor>, CancellationToken)extensionValueTask
Register a set of conventions
public static class DovetailContextExtensions
{
public static ValueTask RegisterJointsAsync(
this IDovetailContext context,
Action<DovetailExecutor> configure,
CancellationToken cancellationToken = default(CancellationToken))
{
// ...
}
}
contextIDovetailContextThe context to execute the conventions against.
configureAction<DovetailExecutor>A callback used to configure which joints the DovetailExecutor should execute.
cancellationTokenCancellationTokenoptionalThe cancellation token used during execution.
ValueTaskA Tasks.ValueTask representing the asynchronous execution of the conventions.
ArgumentNullExceptioncontext or configure is null.
RegisterJointsWithContext(IDovetailContext, Action<DovetailExecutor>)Section titled RegisterJointsWithContext(IDovetailContext, Action<DovetailExecutor>)extensionIDovetailContext
Register a set of conventions
public static class DovetailContextExtensions
{
public static IDovetailContext RegisterJointsWithContext(
this IDovetailContext context,
Action<DovetailExecutor> configure)
{
// ...
}
}
contextIDovetailContextThe context to execute the conventions against.
configureAction<DovetailExecutor>A callback used to configure which joints the DovetailExecutor should execute.
IDovetailContextThe context after executing the conventions.
ArgumentNullExceptioncontext or configure is null.
RegisterJointsWithContextAsync(IDovetailContext, Action<DovetailExecutor>, CancellationToken)Section titled RegisterJointsWithContextAsync(IDovetailContext, Action<DovetailExecutor>, CancellationToken)extensionValueTask<IDovetailContext>
Register a set of conventions
public static class DovetailContextExtensions
{
public static ValueTask<IDovetailContext> RegisterJointsWithContextAsync(
this IDovetailContext context,
Action<DovetailExecutor> configure,
CancellationToken cancellationToken)
{
// ...
}
}
contextIDovetailContextThe context to execute the conventions against.
configureAction<DovetailExecutor>A callback used to configure which joints the DovetailExecutor should execute.
cancellationTokenCancellationTokenThe cancellation token used during execution.
ValueTask<IDovetailContext>A Tasks.ValueTask`1 producing the context after executing the conventions.
ArgumentNullExceptioncontext or configure is null.
Require(IDovetailContext)Section titled Require(IDovetailContext)extensionT
Get a value by type from the context or throw
public static class DovetailContextExtensions
{
public static T Require<T>(
this IDovetailContext context)
{
// ...
}
}
contextIDovetailContextThe context
TT.
ArgumentNullExceptioncontext is null.
KeyNotFoundExceptionNo value of type T was found in the context.
Require(IDovetailContext, string)Section titled Require(IDovetailContext, string)extensionT
Get a value by type from the context or throw
public static class DovetailContextExtensions
{
public static T Require<T>(
this IDovetailContext context,
string key)
{
// ...
}
}
contextIDovetailContextThe context
keystringThe key where the value is saved
TT.
ArgumentNullExceptioncontext is null.
KeyNotFoundExceptionNo value of type T was found at key.
Get a value by type from the context
public static class DovetailContextExtensions
{
public static IDovetailContext Set<T>(
this IDovetailContext context,
T value)
{
// ...
}
}
contextIDovetailContextThe context
valueTThe value to save
ArgumentNullExceptioncontext or value is null.
Set(IDovetailContext, Type, object)Section titled Set(IDovetailContext, Type, object)extensionIDovetailContext
Get a value by type from the context
public static class DovetailContextExtensions
{
public static IDovetailContext Set(
this IDovetailContext context,
Type key,
object value)
{
// ...
}
}
contextIDovetailContextThe context
keyTypeThe key where the value is saved
valueobjectThe value to save
ArgumentNullExceptioncontext or key is null.
Get a value by type from the context
public static class DovetailContextExtensions
{
public static IDovetailContext Set<T>(
this IDovetailContext context,
string key,
T value)
{
// ...
}
}
contextIDovetailContextThe context
keystringThe key where the value is saved
valueTThe value to save
ArgumentNullExceptioncontext is null, or key is null.
ArgumentExceptionkey is empty or consists only of white-space characters.