控制反转、依赖注入、Unity容器

时间:2021-07-31 14:25:54

控制反转原则

依赖注入

Install-Package Unity:https://www.nuget.org/packages/Unity/

Github:https://github.com/unitycontainer/unity

Dependency Injection with Unity:https://msdn.microsoft.com/zh-cn/library/ff660899(v=pandp.20).aspx

Configuring Unity:https://msdn.microsoft.com/zh-cn/library/ff660846(v=pandp.20).aspx

依赖注入开发指南:https://msdn.microsoft.com/en-us/library/dn223671.aspx

ASP.NET MVC 4 依赖注入:https://www.asp.net/mvc/overview/older-versions/hands-on-labs/aspnet-mvc-4-dependency-injection

其他比较常见的IoC容器

【Ninject】:http://www.ninject.org/

【Autofac】:https://github.com/autofac/Autofac

【Spring.NET】:http://springframework.net/