自动接线
ASP.NET CORE字段注入
想法和定位
我们不制造容器,我们只是NetCore Container搬运工(向默认容器添加了一些功能)。
不要在构造函数中使用NAutowired 。
我们尚未替换NetCore默认Container ,这意味着您仍可以使用Startup IServiceCollection将服务添加到Container中。 并使用NAutowired解决依赖关系。
Spring DI风格( ),但是谁在乎呢?
如何使用
在NAutowired.Core中引入了NAutowired和NAutowired.Core。
该NAutowired包只能在web项目中引用,并NAutowired.Core包中需要增加新的功能项目引用。
ASP.NET Core >= 3.0
默认情况下,当ASP.NET Core生成Controller ,将从容器中解析Con