Skip to content

Auto inject services, Microsoft.Extensions.DependencyInjection, easy to add your services without need to touch startup, powerful, useful with multi dll's shearing same startup

License

Notifications You must be signed in to change notification settings

MhozaifaA/Meteors.DependencyInjection.AutoService

Repository files navigation

[Meteors] DependencyInjection.AutoService

Nuget

Install-Package Meteors.DependencyInjection.AutoService -Version 8.0.0

Source Code

//build.Services.AddAutoService(Assembly..namesapces..type);

build.Services.AddAutoService();

...
[AutoService(ServiceLifeTime, InterfaceType)]
[AutoService(ServiceLifeTime, InterfaceType)]
   
[AutoService()]
[AutoService(LifetimeType)]
[AutoService(ImplementationType)]
[AutoService(UseImplementation)]
[AutoService(LifetimeType,ImplementationType)]
[AutoService(LifetimeType,UseImplementation)]
[AutoService(ImplementationType,UseImplementation)] 
[AutoService(LifetimeType,ImplementationType,UseImplementation,ServiceKey)]


[AutoService] //default Scoped
class AnyService : IAnyService { }


[AutoService(typeOf(ICustomInterfaceName))] //take Implementation
class AnyService : ICustomInterfaceName { }


[AutoService(typeOf(ICustomInterfaceName1))] //take Implementation 1
class AnyService : ICustomInterfaceName,ICustomInterfaceName1,ICustomInterfaceName2 { }



[AutoService] //take Implementation IAnyService, is not first but same I + service-name
class AnyService : ICustomInterfaceName,IAnyService,ICustomInterfaceName2 { }


[AutoService] //take class
class AnyService {}

[AutoService]//as UseImplementation=true or null and take first interface
class AnyService : ICustomInterfaceName { }

[AutoService(false)] //UseImplementation=false
class AnyService : ICustomInterfaceName { }

[AutoService("servicekeyed")] //take class, and get by servicekeyed
class AnyService {}

This lib belongs to the Meteors, Meteorites helps you write less and clean code with the power of design patterns and full support for the most popular programming for perpetual projects

All you need in your project is to use meteorites, Simplicity is one in all,

About

Auto inject services, Microsoft.Extensions.DependencyInjection, easy to add your services without need to touch startup, powerful, useful with multi dll's shearing same startup

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages