Class FireflyAbstractionsExtensions
public static class FireflyAbstractionsExtensions
- Inheritance
-
objectFireflyAbstractionsExtensions
Methods
Accepted(IActionContext)
public static void Accepted(this IActionContext ctx)
Parameters
ctxIActionContext
Accepted<T>(IActionContext, T)
public static T Accepted<T>(this IActionContext ctx, T response)
Parameters
ctxIActionContextresponseT
Returns
- T
Type Parameters
T
AddAppJobWorker<TWorker>(IServiceCollection, GlowAppScope)
Add an AppJob worker.
public static IAppJobWorkerBuilder AddAppJobWorker<TWorker>(this IServiceCollection services, GlowAppScope scope = GlowAppScope.Service) where TWorker : class, IAppJobWorker
Parameters
servicesIServiceCollectionscopeGlowAppScope
Returns
Type Parameters
TWorker
AddAppJobWorker<TWorker>(IServiceCollection, string, GlowAppScope)
Add an AppJob worker.
public static IAppJobWorkerBuilder AddAppJobWorker<TWorker>(this IServiceCollection services, string queue, GlowAppScope scope = GlowAppScope.Service) where TWorker : class, IAppJobWorker
Parameters
servicesIServiceCollectionqueuestringscopeGlowAppScope
Returns
Type Parameters
TWorker
AddAppJobWorker<TWorker, TJob>(IServiceCollection, GlowAppScope)
Add an AppJob worker.
public static IAppJobWorkerBuilder AddAppJobWorker<TWorker, TJob>(this IServiceCollection services, GlowAppScope scope = GlowAppScope.Service) where TWorker : class, IAppJobWorker<TJob>
Parameters
servicesIServiceCollectionscopeGlowAppScope
Returns
Type Parameters
TWorkerTJob
AddAppStateMachineWorker<TWorker>(IServiceCollection, GlowAppScope)
Add an AppStateMachine worker.
public static IAppStateMachineWorkerBuilder AddAppStateMachineWorker<TWorker>(this IServiceCollection services, GlowAppScope scope = GlowAppScope.Service) where TWorker : class, IAppStateMachineWorker
Parameters
servicesIServiceCollectionscopeGlowAppScope
Returns
Type Parameters
TWorker
AddAppStateMachineWorker<TWorker>(IServiceCollection, string, GlowAppScope)
Add an AppStateMachine worker.
public static IAppStateMachineWorkerBuilder AddAppStateMachineWorker<TWorker>(this IServiceCollection services, string queue, GlowAppScope scope = GlowAppScope.Service) where TWorker : class, IAppStateMachineWorker
Parameters
servicesIServiceCollectionqueuestringscopeGlowAppScope
Returns
Type Parameters
TWorker
AddAppStateMachineWorker<TWorker, TStateMachine>(IServiceCollection, GlowAppScope)
Add an AppStateMachine worker.
public static IAppStateMachineWorkerBuilder AddAppStateMachineWorker<TWorker, TStateMachine>(this IServiceCollection services, GlowAppScope scope = GlowAppScope.Service) where TWorker : class, IAppStateMachineWorker<TStateMachine> where TStateMachine : struct, Enum
Parameters
servicesIServiceCollectionscopeGlowAppScope
Returns
Type Parameters
TWorkerTStateMachine
AddBackgroundWorker<THostedWorker>(IServiceCollection, bool)
Add a hosted background worker service. It can also be registered as a singleton, so it can be injected to other classes.
public static IServiceCollection AddBackgroundWorker<THostedWorker>(this IServiceCollection services, bool AddSingleton = true) where THostedWorker : FireflyBackgroundWorker
Parameters
servicesIServiceCollectionAddSingletonbool
Returns
Type Parameters
THostedWorker
AddBackgroundWorker<THostedWorker>(IServiceCollection, THostedWorker, bool)
Add a hosted background worker service instance to services. It can also be registered as a singleton, so it can be injected to other classes.
public static IServiceCollection AddBackgroundWorker<THostedWorker>(this IServiceCollection services, THostedWorker instance, bool AddSingleton = true) where THostedWorker : FireflyBackgroundWorker
Parameters
servicesIServiceCollectioninstanceTHostedWorkerAddSingletonbool
Returns
Type Parameters
THostedWorker
AddInteropMessagePackResolver(IServiceCollection, IFormatterResolver)
public static IServiceCollection AddInteropMessagePackResolver(this IServiceCollection services, IFormatterResolver resolver)
Parameters
servicesIServiceCollectionresolverIFormatterResolver
Returns
AddSingletonHostedService<THostedService>(IServiceCollection)
Add a hosted service and register it a singleton, so it can be injected to other classes
public static IServiceCollection AddSingletonHostedService<THostedService>(this IServiceCollection services) where THostedService : class, IHostedService
Parameters
servicesIServiceCollection
Returns
Type Parameters
THostedService
AddSingletonHostedService<THostedService>(IServiceCollection, THostedService)
Add a hosted service and register it a singleton, so it can be injected to other classes
public static IServiceCollection AddSingletonHostedService<THostedService>(this IServiceCollection services, THostedService instance) where THostedService : class, IHostedService
Parameters
servicesIServiceCollectioninstanceTHostedService
Returns
Type Parameters
THostedService
AddSingletonHostedService<TService, THostedService>(IServiceCollection)
Add a hosted service and register it a singleton, so it can be injected to other classes
public static IServiceCollection AddSingletonHostedService<TService, THostedService>(this IServiceCollection services) where TService : class where THostedService : class, TService, IHostedService
Parameters
servicesIServiceCollection
Returns
Type Parameters
TServiceTHostedService
AddSingletonHostedService<TService, THostedService>(IServiceCollection, THostedService)
Add a hosted service and register it a singleton, so it can be injected to other classes
public static IServiceCollection AddSingletonHostedService<TService, THostedService>(this IServiceCollection services, THostedService instance) where TService : class where THostedService : class, TService, IHostedService
Parameters
servicesIServiceCollectioninstanceTHostedService
Returns
Type Parameters
TServiceTHostedService
BadGateway(IActionContext)
public static void BadGateway(this IActionContext ctx)
Parameters
ctxIActionContext
BadGateway(IActionContext, ProblemDetails)
public static void BadGateway(this IActionContext ctx, ProblemDetails problem)
Parameters
ctxIActionContextproblemProblemDetails
BadGateway<T>(IActionContext, T)
public static T BadGateway<T>(this IActionContext ctx, T response)
Parameters
ctxIActionContextresponseT
Returns
- T
Type Parameters
T
BadRequest(IActionContext)
public static void BadRequest(this IActionContext ctx)
Parameters
ctxIActionContext
BadRequest(IActionContext, ProblemDetails)
public static void BadRequest(this IActionContext ctx, ProblemDetails problem)
Parameters
ctxIActionContextproblemProblemDetails
BadRequest<T>(IActionContext, T)
public static T BadRequest<T>(this IActionContext ctx, T response)
Parameters
ctxIActionContextresponseT
Returns
- T
Type Parameters
T
ExpectationFailed(IActionContext)
public static void ExpectationFailed(this IActionContext ctx)
Parameters
ctxIActionContext
ExpectationFailed(IActionContext, ProblemDetails)
public static void ExpectationFailed(this IActionContext ctx, ProblemDetails problem)
Parameters
ctxIActionContextproblemProblemDetails
ExpectationFailed<T>(IActionContext, T)
public static T ExpectationFailed<T>(this IActionContext ctx, T response)
Parameters
ctxIActionContextresponseT
Returns
- T
Type Parameters
T
Forbidden(IActionContext)
public static void Forbidden(this IActionContext ctx)
Parameters
ctxIActionContext
Forbidden(IActionContext, ProblemDetails)
public static void Forbidden(this IActionContext ctx, ProblemDetails problem)
Parameters
ctxIActionContextproblemProblemDetails
Forbidden<T>(IActionContext, T)
public static T Forbidden<T>(this IActionContext ctx, T response)
Parameters
ctxIActionContextresponseT
Returns
- T
Type Parameters
T
GetAssemblyQualifiedKey(MethodInfo)
public static string GetAssemblyQualifiedKey(this MethodInfo m)
Parameters
Returns
GetMemberType(MemberInfo)
public static Type? GetMemberType(this MemberInfo mi)
Parameters
miMemberInfo
Returns
GetValue(MemberInfo?, object?)
public static object? GetValue(this MemberInfo? mi, object? Instance)
Parameters
miMemberInfoInstanceobject
Returns
- object
InternalServerError(IActionContext)
public static void InternalServerError(this IActionContext ctx)
Parameters
ctxIActionContext
InternalServerError(IActionContext, ProblemDetails)
public static void InternalServerError(this IActionContext ctx, ProblemDetails problem)
Parameters
ctxIActionContextproblemProblemDetails
InternalServerError<T>(IActionContext, T)
public static T InternalServerError<T>(this IActionContext ctx, T response)
Parameters
ctxIActionContextresponseT
Returns
- T
Type Parameters
T
IsReadable(MemberInfo)
public static bool IsReadable(this MemberInfo mi)
Parameters
miMemberInfo
Returns
IsStatic(MemberInfo?)
public static bool IsStatic(this MemberInfo? mi)
Parameters
miMemberInfo
Returns
IsWriteable(MemberInfo)
public static bool IsWriteable(this MemberInfo mi)
Parameters
miMemberInfo
Returns
NotAcceptable(IActionContext)
public static void NotAcceptable(this IActionContext ctx)
Parameters
ctxIActionContext
NotAcceptable(IActionContext, ProblemDetails)
public static void NotAcceptable(this IActionContext ctx, ProblemDetails problem)
Parameters
ctxIActionContextproblemProblemDetails
NotAcceptable<T>(IActionContext, T)
public static T NotAcceptable<T>(this IActionContext ctx, T response)
Parameters
ctxIActionContextresponseT
Returns
- T
Type Parameters
T
NotFound(IActionContext)
public static void NotFound(this IActionContext ctx)
Parameters
ctxIActionContext
NotFound(IActionContext, ProblemDetails)
public static void NotFound(this IActionContext ctx, ProblemDetails problem)
Parameters
ctxIActionContextproblemProblemDetails
NotFound<T>(IActionContext, T)
public static T NotFound<T>(this IActionContext ctx, T response)
Parameters
ctxIActionContextresponseT
Returns
- T
Type Parameters
T
NotImplemented(IActionContext)
public static void NotImplemented(this IActionContext ctx)
Parameters
ctxIActionContext
NotImplemented(IActionContext, ProblemDetails)
public static void NotImplemented(this IActionContext ctx, ProblemDetails problem)
Parameters
ctxIActionContextproblemProblemDetails
NotImplemented<T>(IActionContext, T)
public static T NotImplemented<T>(this IActionContext ctx, T response)
Parameters
ctxIActionContextresponseT
Returns
- T
Type Parameters
T
OK(IActionContext)
public static void OK(this IActionContext ctx)
Parameters
ctxIActionContext
OK<T>(IActionContext, T)
public static T OK<T>(this IActionContext ctx, T response)
Parameters
ctxIActionContextresponseT
Returns
- T
Type Parameters
T
SetRayAppUserEmail(ILogger, string)
Tag the ray with an application user email string, that can used later for filtering logs.
public static void SetRayAppUserEmail(this ILogger logger, string email)
Parameters
SetRayAppUserId(ILogger, string)
Tag the ray with an application user id string, that can used later for filtering logs.
public static void SetRayAppUserId(this ILogger logger, string id)
Parameters
SetRayAppUserName(ILogger, string)
Tag the ray with an application user name string, that can used later for filtering logs.
public static void SetRayAppUserName(this ILogger logger, string username)
Parameters
SetRayTag(ILogger, string)
Tag the ray with a user-defined string, that can used later for filtering logs.
public static void SetRayTag(this ILogger logger, string tag)
Parameters
SetValue(MemberInfo?, object?, object?)
public static bool SetValue(this MemberInfo? mi, object? Instance, object? Value)
Parameters
miMemberInfoInstanceobjectValueobject
Returns
SingleGlobalConsumer(IAppJobWorkerBuilder)
When enabled, only ONE service instance in the entire Quantum-Space will consume jobs.
public static IAppJobWorkerBuilder SingleGlobalConsumer(this IAppJobWorkerBuilder builder)
Parameters
builderIAppJobWorkerBuilder
Returns
SingleGlobalConsumer(IAppJobWorkerBuilder, bool)
When enabled, only ONE service instance in the entire Quantum-Space will consume jobs.
public static IAppJobWorkerBuilder SingleGlobalConsumer(this IAppJobWorkerBuilder builder, bool isSingleton)
Parameters
builderIAppJobWorkerBuilderisSingletonboolEnable Global Quantum-Space singleton
Returns
SingleGlobalConsumer(IAppStateMachineWorkerBuilder)
When enabled, only ONE service instance in the entire Quantum-Space will consume state-machine jobs.
public static IAppStateMachineWorkerBuilder SingleGlobalConsumer(this IAppStateMachineWorkerBuilder builder)
Parameters
builderIAppStateMachineWorkerBuilder
Returns
SingleGlobalConsumer(IAppStateMachineWorkerBuilder, bool)
When enabled, only ONE service instance in the entire Quantum-Space will consume state-machine jobs.
public static IAppStateMachineWorkerBuilder SingleGlobalConsumer(this IAppStateMachineWorkerBuilder builder, bool isSingleton)
Parameters
builderIAppStateMachineWorkerBuilderisSingletonboolEnable Global Quantum-Space singleton
Returns
Unauthorized(IActionContext)
public static void Unauthorized(this IActionContext ctx)
Parameters
ctxIActionContext
Unauthorized(IActionContext, ProblemDetails)
public static void Unauthorized(this IActionContext ctx, ProblemDetails problem)
Parameters
ctxIActionContextproblemProblemDetails
Unauthorized<T>(IActionContext, T)
public static T Unauthorized<T>(this IActionContext ctx, T response)
Parameters
ctxIActionContextresponseT
Returns
- T
Type Parameters
T
When(IAppJobWorkerBuilder, WorkerRunAsyncPredicateDelegate)
User-defined condition to control whether worker is allowed to request and run a new Job
public static IAppJobWorkerBuilder When(this IAppJobWorkerBuilder builder, WorkerRunAsyncPredicateDelegate predicate)
Parameters
builderIAppJobWorkerBuilderpredicateWorkerRunAsyncPredicateDelegateCheck whether worker is allowed to process a new job
Returns
When(IAppJobWorkerBuilder, WorkerRunPredicateDelegate)
User-defined condition to control whether worker is allowed to request and run a new Job
public static IAppJobWorkerBuilder When(this IAppJobWorkerBuilder builder, WorkerRunPredicateDelegate predicate)
Parameters
builderIAppJobWorkerBuilderpredicateWorkerRunPredicateDelegateCheck whether worker is allowed to process a new job
Returns
WithController(IAppJobWorkerBuilder, IAppJobWorkerController)
Control worker behavior from user code
public static IAppJobWorkerBuilder WithController(this IAppJobWorkerBuilder builder, IAppJobWorkerController controller)
Parameters
builderIAppJobWorkerBuildercontrollerIAppJobWorkerControllerThe controller
Returns
WithController(IAppStateMachineWorkerBuilder, IAppStateMachineWorkerController)
Control worker behavior from user code
public static IAppStateMachineWorkerBuilder WithController(this IAppStateMachineWorkerBuilder builder, IAppStateMachineWorkerController controller)
Parameters
builderIAppStateMachineWorkerBuildercontrollerIAppStateMachineWorkerControllerThe controller
Returns
WithParallelism(IAppJobWorkerBuilder, int)
Set Parallelism for job processing. Default is Environment.ProcessorCount * 5 This configures local parallelism for each service instance.
public static IAppJobWorkerBuilder WithParallelism(this IAppJobWorkerBuilder builder, int parallelism)
Parameters
builderIAppJobWorkerBuilderparallelismintThe number of worker to run in parallel
Returns
WithParallelism(IAppStateMachineWorkerBuilder, int)
Set Parallelism for state-machine processing. Default is Environment.ProcessorCount * 5 This configures local parallelism for each service instance.
public static IAppStateMachineWorkerBuilder WithParallelism(this IAppStateMachineWorkerBuilder builder, int parallelism)
Parameters
builderIAppStateMachineWorkerBuilderparallelismintThe number of worker to run in parallel
Returns
WithProblem(IActionContext, HttpStatusCode, ProblemDetails)
public static void WithProblem(this IActionContext ctx, HttpStatusCode code, ProblemDetails problem)
Parameters
ctxIActionContextcodeHttpStatusCodeproblemProblemDetails
WithRateLimitter(IAppJobWorkerBuilder, RateLimiter)
Rate-limit job processing.
public static IAppJobWorkerBuilder WithRateLimitter(this IAppJobWorkerBuilder builder, RateLimiter rateLimiter)
Parameters
builderIAppJobWorkerBuilderrateLimiterRateLimiterThe rate-limiter
Returns
WithRateLimitter(IAppStateMachineWorkerBuilder, RateLimiter)
Rate-limit state-machine processing.
public static IAppStateMachineWorkerBuilder WithRateLimitter(this IAppStateMachineWorkerBuilder builder, RateLimiter rateLimiter)
Parameters
builderIAppStateMachineWorkerBuilderrateLimiterRateLimiterThe rate-limiter
Returns
WithScope(IAppJobWorkerBuilder, GlowAppScope)
Set scope.
public static IAppJobWorkerBuilder WithScope(this IAppJobWorkerBuilder builder, GlowAppScope scope)
Parameters
builderIAppJobWorkerBuilderscopeGlowAppScopeThe scope of the queue.
- QuantumSpace scope means the queue is shared with other services in the same QuantumSpace.
- Service scope means this queue is only visible to other instances of the same service.
Returns
WithScope(IAppStateMachineWorkerBuilder, GlowAppScope)
Set scope.
public static IAppStateMachineWorkerBuilder WithScope(this IAppStateMachineWorkerBuilder builder, GlowAppScope scope)
Parameters
builderIAppStateMachineWorkerBuilderscopeGlowAppScopeThe scope of the queue.
- QuantumSpace scope means the queue is shared with other services in the same QuantumSpace.
- Service scope means this queue is only visible to other instances of the same service.
Returns
WithStatusCode(IActionContext, HttpStatusCode)
public static void WithStatusCode(this IActionContext ctx, HttpStatusCode code)
Parameters
ctxIActionContextcodeHttpStatusCode
WithStatusCode<T>(IActionContext, HttpStatusCode, T)
public static T WithStatusCode<T>(this IActionContext ctx, HttpStatusCode code, T response)
Parameters
ctxIActionContextcodeHttpStatusCoderesponseT
Returns
- T
Type Parameters
T