DepencyInjectionExtension
1.0.0
.NET依赖注入标准的轻量级库
nuget:https://www.nuget.org/packages/depperencyindoction.extensions/
例子:
[ TransientDependency ( typeof ( IService ) ) ]
public class Service : IService
{
public Service ( )
{
}
}格式: [<AttribuleLyfeCycle>(typeof(<InterfaceType>))]
InjectAllServices扩展方法作为显示代码片段Bellow: public void ConfigureServices ( IServiceCollection services )
{
services . AddMvc ( ) . SetCompatibilityVersion ( CompatibilityVersion . Version_2_2 ) ;
services . InjectAllServices ( ) ;
}