What is the current state of IoC containers in .NET? [closed]

三世轮回 提交于 2019-12-11 17:11:44

问题


I know similar questions have been asked before

I'm looking to get the current state of IoC container framework in the .NET sphere.

Other questions on this topic are pretty dated. I'm prepping for a course on the subject, so I would like to present the most relevant information.

What currently is the best in IoC containers in .NET and why?
What is the most popular?


回答1:


No-one knows which DI Container is the most popular one, but here's a tip:

Compare download statistics on NuGet. All the major .NET containers are available through NuGet, so doing that will give you an idea about the relative popularity ranking between the containers.

Be aware that this method is problematic from a statistical viewpoint for a number of reasons:

  • There are other ways to download the containers. As an example, Unity also ships with Enterprise Library and can be downloaded from microsoft.com.
  • Downloads don't equal usage.
  • NuGet is (AFAIR) only available in Visual Studio 2010, so there may be a selection bias. Users of previous versions of Visual Studio may prefer different containers.

Despite the inaccuracy of the suggested comparison method, it's still the best that I'm aware of. Take it for what it is.




回答2:


I think Scott Hanselman's post from a couple of years ago is still relevant List of .NET Dependency Injection Containers (IOC)

Each of the container frameworks has added functionality and refined, all seem to support fluent interfaces now.

Personally I use Autofac

Nicholas Blumhardt has written a great article 'The Relationship Zoo' which describes in detail what you can do with Dependency Injection these days - well worth the read.



来源:https://stackoverflow.com/questions/6854445/what-is-the-current-state-of-ioc-containers-in-net

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!