DovetailContextExtensions Methods
ClassMethods18 members
Base convention extensions
AddIfMissing(IDovetailContext, T) Section titled AddIfMissing(IDovetailContext, T)extensionI Set key to the value if the type is missing
public static class DovetailContextExtensions{ public static IDovetailContext AddIfMissing<T>( this IDovetailContext context, T value) { // ... }}Parameters
contextIvalueTThe value to saveReturns
IDovetailContext The context, for chaining.Exceptions
ArgumentNullExceptioncontext is null.AddIfMissing(IDovetailContext, Type, object) Section titled AddIfMissing(IDovetailContext, Type, object)extensionI 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) { // ... }}Parameters
contextIkeyTypeThe key where the value is savedvalueobjectThe value to saveReturns
IDovetailContext The context, for chaining.Exceptions
ArgumentNullExceptioncontext is null.AddIfMissing(IDovetailContext, string, T) Section titled AddIfMissing(IDovetailContext, string, T)extensionI 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) { // ... }}Parameters
contextIkeystringThe key where the value is savedvalueTThe value to saveReturns
IDovetailContext The context, for chaining.Exceptions
ArgumentNullExceptioncontext is null. Get a value by type from the context
public static class DovetailContextExtensions{ public static T? Get<T>( this IDovetailContext context) { // ... }}Parameters
contextIReturns
T?T.Exceptions
ArgumentNullExceptioncontext is null. Get a value by key from the context
public static class DovetailContextExtensions{ public static T? Get<T>( this IDovetailContext context, string key) { // ... }}Parameters
contextIkeystringThe key where the value is savedReturns
T?T.Exceptions
ArgumentNullExceptioncontext is null. Get the host type the context is currently running under
public static class DovetailContextExtensions{ public static DovetailHostType GetHostType( this IDovetailContext context) { // ... }}Parameters
contextIReturns
DovetailHostType The DovetailHostType for the context, or DovetailHostType.Undefined if none was registered.Exceptions
ArgumentNullExceptioncontext is null. Get a value by key from the context
public static class DovetailContextExtensions{ public static T GetOrAdd<T>( this IDovetailContext context, Func<T> factory) { // ... }}Parameters
contextIfactoryFunc<T> The factory method in the event the type is not foundReturns
TT.Exceptions
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) { // ... }}Parameters
contextIkeystringThe key where the value is savedfactoryFunc<T> The factory method in the event the type is not foundReturns
TT.Exceptions
ArgumentNullExceptioncontext or factory is null. 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) { // ... }}Parameters
contextIReturns
booltrue if context is running under DovetailHostType.UnitTest ; otherwise, false.Exceptions
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) { // ... }}Parameters
contextIconfigureAction<DovetailExecutor> A callback used to configure which joints the DovetailExecutor should execute.Exceptions
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)) { // ... }}Parameters
contextIconfigureAction<DovetailExecutor> A callback used to configure which joints the DovetailExecutor should execute.cancellationToken CancellationToken optionalThe cancellation token used during execution.Returns
ValueTask A Tasks.ValueTask representing the asynchronous execution of the conventions.Exceptions
ArgumentNullExceptioncontext or configure is null.RegisterJointsWithContext(IDovetailContext, Action<DovetailExecutor>) Section titled RegisterJointsWithContext(IDovetailContext, Action<DovetailExecutor>)extensionI Register a set of conventions
public static class DovetailContextExtensions{ public static IDovetailContext RegisterJointsWithContext( this IDovetailContext context, Action<DovetailExecutor> configure) { // ... }}Parameters
contextIconfigureAction<DovetailExecutor> A callback used to configure which joints the DovetailExecutor should execute.Returns
IDovetailContext The context after executing the conventions.Exceptions
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) { // ... }}Parameters
contextIconfigureAction<DovetailExecutor> A callback used to configure which joints the DovetailExecutor should execute.cancellationToken CancellationToken The cancellation token used during execution.Returns
ValueTask<IDovetailContext> A Tasks.ValueTask`1 producing the context after executing the conventions.Exceptions
ArgumentNullExceptioncontext or configure is null. Get a value by type from the context or throw
public static class DovetailContextExtensions{ public static T Require<T>( this IDovetailContext context) { // ... }}Parameters
contextIReturns
TT.Exceptions
ArgumentNullExceptioncontext is null.KeyNotFoundExceptionNo value of type T was found in the context. Get a value by type from the context or throw
public static class DovetailContextExtensions{ public static T Require<T>( this IDovetailContext context, string key) { // ... }}Parameters
contextIkeystringThe key where the value is savedReturns
TT.Exceptions
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) { // ... }}Parameters
contextIvalueTThe value to saveExceptions
ArgumentNullExceptioncontext or value is null.Set(IDovetailContext, Type, object) Section titled Set(IDovetailContext, Type, object)extensionI Get a value by type from the context
public static class DovetailContextExtensions{ public static IDovetailContext Set( this IDovetailContext context, Type key, object value) { // ... }}Parameters
contextIkeyTypeThe key where the value is savedvalueobjectThe value to saveExceptions
ArgumentNullExceptioncontext or key is null.Set(IDovetailContext, string, T) Section titled Set(IDovetailContext, string, T)extensionI Get a value by type from the context
public static class DovetailContextExtensions{ public static IDovetailContext Set<T>( this IDovetailContext context, string key, T value) { // ... }}Parameters
Exceptions
ArgumentNullExceptioncontext is null, or key is null.ArgumentExceptionkey is empty or consists only of white-space characters.