Skip to content

a fine solution to access service collection from static classes

Notifications You must be signed in to change notification settings

exitxhu/ServiceCollectionAccessorService

Repository files navigation

Service Collection Accessor

this package help you to work around the issue with DI and Static classes

Usage

1-Add package to your project

2- inject it : services.AddServiceCollectionAccessor();

3- use it anywhere you need like this:

private static LogData GetLogData() => ServiceCollectionAccessor.Services.BuildServiceProvider().GetRequiredService<LogData>();

or any other way you need it

4- smile :)

About

a fine solution to access service collection from static classes

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages