containerBuilder.RegisterInstance(new PostRepository()).As<IPostRepository>();
containerBuilder.RegisterType<PostRepository>().As<IPostRepository>();
我一直在尝试将Autofac集成到我的Web Api应用程序中。我一直在进行上面的组件注册。
这两种类型的注册是否相同,如果没有哪一种比另一种更好,以什么方式?
我已阅读的帖子
Integrating with ASP.NET Web API
Dependency Injection in ASP.NET Web API using Autofac
Autofac and ASP.NET Web API System.Web.Http.Services.IDependencyResolver Integration