Skip to content

Repository files navigation

Utils

Set of my helpers

DI utils

AddTypeAndImplementation

Register service both as TService and TImplementation with transient lifetime

IServiceCollectionservices=new();services.AddTypeAndImplementation<IInterface,Service>();

NotEndingBackgroundService

Wrapper for BetterHostedServices.CriticalBackgroundService Allows you to forget about IApplicationEnder

classService:NotEndingCriticalBackgroundService{protectedoverrideTaskExecute(CancellationTokentoken){// Do stuff}protectedoverridevoidOnError(Exceptionexception){// Handle exception}}

Logging utils

LogExceptionMessage

Allows you to fluent log exception before throw it. Default LogLevel is Critical

thrownewArgumentException().LogExceptionMessage(logger);thrownewArgumentException().LogExceptionMessage(logger,LogLevel.Debug);

Options utils

AddOptions

Overload that take Action for more useful calls chaining

services.AddOptions<CustomizableField.Configuration>(builder =>builder.BindConfiguration(CustomizableField.Configuration.SectionName).Validate(CustomizableField.Configuration.Validate)).AddOptions<AiPlayer.AiPlayerBehaviour>(builder =>builder.BindConfiguration(AiPlayer.AiPlayerBehaviour.SectionName));

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages