Skip to content

Latest commit

 

History

History
75 lines (44 loc) · 2.36 KB

File metadata and controls

75 lines (44 loc) · 2.36 KB

[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,