Class FireflyAbstractionsExtensions
public static class FireflyAbstractionsExtensions
- Inheritance
-
objectFireflyAbstractionsExtensions
Methods
Accepted(IActionContext)
public static void Accepted(this IActionContext ctx)
Parameters
ctx
IActionContext
Accepted<T>(IActionContext, T)
public static T Accepted<T>(this IActionContext ctx, T response)
Parameters
ctx
IActionContextresponse
T
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
services
IServiceCollectionscope
GlowAppScope
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
services
IServiceCollectionqueue
stringscope
GlowAppScope
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
services
IServiceCollectionscope
GlowAppScope
Returns
Type Parameters
TWorker
TJob
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
services
IServiceCollectionscope
GlowAppScope
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
services
IServiceCollectionqueue
stringscope
GlowAppScope
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
services
IServiceCollectionscope
GlowAppScope
Returns
Type Parameters
TWorker
TStateMachine
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
services
IServiceCollectionAddSingleton
bool
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
services
IServiceCollectioninstance
THostedWorkerAddSingleton
bool
Returns
Type Parameters
THostedWorker
AddInteropMessagePackResolver(IServiceCollection, IFormatterResolver)
public static IServiceCollection AddInteropMessagePackResolver(this IServiceCollection services, IFormatterResolver resolver)
Parameters
services
IServiceCollectionresolver
IFormatterResolver
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
services
IServiceCollection
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
services
IServiceCollectioninstance
THostedService
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
services
IServiceCollection
Returns
Type Parameters
TService
THostedService
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
services
IServiceCollectioninstance
THostedService
Returns
Type Parameters
TService
THostedService
BadGateway(IActionContext)
public static void BadGateway(this IActionContext ctx)
Parameters
ctx
IActionContext
BadGateway(IActionContext, ProblemDetails)
public static void BadGateway(this IActionContext ctx, ProblemDetails problem)
Parameters
ctx
IActionContextproblem
ProblemDetails
BadGateway<T>(IActionContext, T)
public static T BadGateway<T>(this IActionContext ctx, T response)
Parameters
ctx
IActionContextresponse
T
Returns
- T
Type Parameters
T
BadRequest(IActionContext)
public static void BadRequest(this IActionContext ctx)
Parameters
ctx
IActionContext
BadRequest(IActionContext, ProblemDetails)
public static void BadRequest(this IActionContext ctx, ProblemDetails problem)
Parameters
ctx
IActionContextproblem
ProblemDetails
BadRequest<T>(IActionContext, T)
public static T BadRequest<T>(this IActionContext ctx, T response)
Parameters
ctx
IActionContextresponse
T
Returns
- T
Type Parameters
T
ExpectationFailed(IActionContext)
public static void ExpectationFailed(this IActionContext ctx)
Parameters
ctx
IActionContext
ExpectationFailed(IActionContext, ProblemDetails)
public static void ExpectationFailed(this IActionContext ctx, ProblemDetails problem)
Parameters
ctx
IActionContextproblem
ProblemDetails
ExpectationFailed<T>(IActionContext, T)
public static T ExpectationFailed<T>(this IActionContext ctx, T response)
Parameters
ctx
IActionContextresponse
T
Returns
- T
Type Parameters
T
Forbidden(IActionContext)
public static void Forbidden(this IActionContext ctx)
Parameters
ctx
IActionContext
Forbidden(IActionContext, ProblemDetails)
public static void Forbidden(this IActionContext ctx, ProblemDetails problem)
Parameters
ctx
IActionContextproblem
ProblemDetails
Forbidden<T>(IActionContext, T)
public static T Forbidden<T>(this IActionContext ctx, T response)
Parameters
ctx
IActionContextresponse
T
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
mi
MemberInfo
Returns
GetValue(MemberInfo?, object?)
public static object? GetValue(this MemberInfo? mi, object? Instance)
Parameters
mi
MemberInfoInstance
object
Returns
- object
InternalServerError(IActionContext)
public static void InternalServerError(this IActionContext ctx)
Parameters
ctx
IActionContext
InternalServerError(IActionContext, ProblemDetails)
public static void InternalServerError(this IActionContext ctx, ProblemDetails problem)
Parameters
ctx
IActionContextproblem
ProblemDetails
InternalServerError<T>(IActionContext, T)
public static T InternalServerError<T>(this IActionContext ctx, T response)
Parameters
ctx
IActionContextresponse
T
Returns
- T
Type Parameters
T
IsReadable(MemberInfo)
public static bool IsReadable(this MemberInfo mi)
Parameters
mi
MemberInfo
Returns
IsStatic(MemberInfo?)
public static bool IsStatic(this MemberInfo? mi)
Parameters
mi
MemberInfo
Returns
IsWriteable(MemberInfo)
public static bool IsWriteable(this MemberInfo mi)
Parameters
mi
MemberInfo
Returns
NotAcceptable(IActionContext)
public static void NotAcceptable(this IActionContext ctx)
Parameters
ctx
IActionContext
NotAcceptable(IActionContext, ProblemDetails)
public static void NotAcceptable(this IActionContext ctx, ProblemDetails problem)
Parameters
ctx
IActionContextproblem
ProblemDetails
NotAcceptable<T>(IActionContext, T)
public static T NotAcceptable<T>(this IActionContext ctx, T response)
Parameters
ctx
IActionContextresponse
T
Returns
- T
Type Parameters
T
NotFound(IActionContext)
public static void NotFound(this IActionContext ctx)
Parameters
ctx
IActionContext
NotFound(IActionContext, ProblemDetails)
public static void NotFound(this IActionContext ctx, ProblemDetails problem)
Parameters
ctx
IActionContextproblem
ProblemDetails
NotFound<T>(IActionContext, T)
public static T NotFound<T>(this IActionContext ctx, T response)
Parameters
ctx
IActionContextresponse
T
Returns
- T
Type Parameters
T
NotImplemented(IActionContext)
public static void NotImplemented(this IActionContext ctx)
Parameters
ctx
IActionContext
NotImplemented(IActionContext, ProblemDetails)
public static void NotImplemented(this IActionContext ctx, ProblemDetails problem)
Parameters
ctx
IActionContextproblem
ProblemDetails
NotImplemented<T>(IActionContext, T)
public static T NotImplemented<T>(this IActionContext ctx, T response)
Parameters
ctx
IActionContextresponse
T
Returns
- T
Type Parameters
T
OK(IActionContext)
public static void OK(this IActionContext ctx)
Parameters
ctx
IActionContext
OK<T>(IActionContext, T)
public static T OK<T>(this IActionContext ctx, T response)
Parameters
ctx
IActionContextresponse
T
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
mi
MemberInfoInstance
objectValue
object
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
builder
IAppJobWorkerBuilder
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
builder
IAppJobWorkerBuilderisSingleton
boolEnable 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
builder
IAppStateMachineWorkerBuilder
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
builder
IAppStateMachineWorkerBuilderisSingleton
boolEnable Global Quantum-Space singleton
Returns
Unauthorized(IActionContext)
public static void Unauthorized(this IActionContext ctx)
Parameters
ctx
IActionContext
Unauthorized(IActionContext, ProblemDetails)
public static void Unauthorized(this IActionContext ctx, ProblemDetails problem)
Parameters
ctx
IActionContextproblem
ProblemDetails
Unauthorized<T>(IActionContext, T)
public static T Unauthorized<T>(this IActionContext ctx, T response)
Parameters
ctx
IActionContextresponse
T
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
builder
IAppJobWorkerBuilderpredicate
WorkerRunAsyncPredicateDelegateCheck 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
builder
IAppJobWorkerBuilderpredicate
WorkerRunPredicateDelegateCheck 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
builder
IAppJobWorkerBuildercontroller
IAppJobWorkerControllerThe controller
Returns
WithController(IAppStateMachineWorkerBuilder, IAppStateMachineWorkerController)
Control worker behavior from user code
public static IAppStateMachineWorkerBuilder WithController(this IAppStateMachineWorkerBuilder builder, IAppStateMachineWorkerController controller)
Parameters
builder
IAppStateMachineWorkerBuildercontroller
IAppStateMachineWorkerControllerThe 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
builder
IAppJobWorkerBuilderparallelism
intThe 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
builder
IAppStateMachineWorkerBuilderparallelism
intThe number of worker to run in parallel
Returns
WithProblem(IActionContext, HttpStatusCode, ProblemDetails)
public static void WithProblem(this IActionContext ctx, HttpStatusCode code, ProblemDetails problem)
Parameters
ctx
IActionContextcode
HttpStatusCodeproblem
ProblemDetails
WithRateLimitter(IAppJobWorkerBuilder, RateLimiter)
Rate-limit job processing.
public static IAppJobWorkerBuilder WithRateLimitter(this IAppJobWorkerBuilder builder, RateLimiter rateLimiter)
Parameters
builder
IAppJobWorkerBuilderrateLimiter
RateLimiterThe rate-limiter
Returns
WithRateLimitter(IAppStateMachineWorkerBuilder, RateLimiter)
Rate-limit state-machine processing.
public static IAppStateMachineWorkerBuilder WithRateLimitter(this IAppStateMachineWorkerBuilder builder, RateLimiter rateLimiter)
Parameters
builder
IAppStateMachineWorkerBuilderrateLimiter
RateLimiterThe rate-limiter
Returns
WithScope(IAppJobWorkerBuilder, GlowAppScope)
Set scope.
public static IAppJobWorkerBuilder WithScope(this IAppJobWorkerBuilder builder, GlowAppScope scope)
Parameters
builder
IAppJobWorkerBuilderscope
GlowAppScopeThe 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
builder
IAppStateMachineWorkerBuilderscope
GlowAppScopeThe 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
ctx
IActionContextcode
HttpStatusCode
WithStatusCode<T>(IActionContext, HttpStatusCode, T)
public static T WithStatusCode<T>(this IActionContext ctx, HttpStatusCode code, T response)
Parameters
ctx
IActionContextcode
HttpStatusCoderesponse
T
Returns
- T
Type Parameters
T