Unity 容器和对 dotnet Core/netstandard 的支持 [英] Unity Container and Support for dotnet Core / netstandard

查看:52
本文介绍了Unity 容器和对 dotnet Core/netstandard 的支持的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以 MS 放弃了(免费获得的)Unity.统一的未来
github 存储库似乎处于非活动状态 GitHub 上的 Unity

So MS dropped (free sourced) Unity. Future of Unity
The github repository appears inactive Unity on GitHub

有人知道 Unity 发生了什么吗?
是否有针对 dotNet Core 的 IOC 依赖注入工具,如果 Unity 是 dotnet 核心下的死胡同?

Anybody know what is going on with Unity ?
Is there a IOC Dependency Injection tool for dotNet Core, if Unity is a dead end under dotnet core?

仍在等待有关 Unity 的消息.
搜索者的替代方案:StructureMapAutoFac
或者我们的选择,SimpleInjector 它在 GitHub 上非常活跃.仅 Nuget 每天就有很多下载量已经达到约 100 万次.它速度快,文档齐全,是一个很好的 API,具有良好的可扩展性.Microsoft.Extensions.DependencyInjection 将是下一个选择.我们没有 ASP.NET 项目,如果你有那么肯定看看 MS DI.您也可以在 DotNet Core 中使用 MS DI,
我更喜欢 SimpleInjector.文档很好,每天下载超过 500 次,总下载量超过 100 万次,Simpleinjector 已经超过了临界质量.

Still waiting on news about Unity.
Alternatives for those searching: StructureMap , AutoFac
or our selection , SimpleInjector It very active on GitHub. There are many downloads daily already ~1Million from Nuget alone. And its fast, very well documented, a nice API with good extensibility. Microsoft.Extensions.DependencyInjection would have been the next choice. We dont have ASP.NET project, If you do then definitely look at MS DI. You can use MS DI in DotNet Core too,
I like SimpleInjector more. The docu is good, with over 500 downloads a day and more than 1 million in total, Simpleinjector has gone past critical mass.

Unity 可能只是为 .netcore 做一个凤凰.它仍然在踢.
在 github 上查看 Unity 的 .netStandard 讨论.虽然还没有很多活动.至少有一些支持让它在 Core 上工作.问题是会不会太少太晚?较晚的迁移者可能仍会受益.目前(2018 年)看起来仍然需要替代方案.
SimpleInjector 作为合法的替代品正在取得稳步进展.
参见 SimpleInjector Nuget 页面.近 300 万次下载,每天超过 1000 次.截至 2018 年 6 月.

Unity might just do a phoenix for .netcore. It is still kicking.
See Unity for .netStandard discussion on github. Although there isnt a great deal of activity yet. There is at least some support to get it working on Core. The question is will it be too little too late? Late migrators may still benefit. For now (2018) it still looks like alternatives are requried.
SimpleInjector is on making solid progress as a legitimate replacement.
See SimpleInjector Nuget page. Nearly 3 million downloads and >1k per day. As of June 2018.

推荐答案

对于 net core 你可以找到一个关于依赖注入的很好的教程:

For net core you can find a nice tutorial about Dependency Injection:

https://docs.microsoft.com/en-us/aspnet/core/fundamentals/dependency-injectionhttps://blogs.msdn.microsoft.com/webdev/2016/03/28/dependency-injection-in-asp-net-core/

恕我直言,实施和使用 Microsoft.Extensions.DependencyInjection 也更容易.(至少对于 MVC-Web-Applications)您不再需要统一.

Imho, implementing and using the Microsoft.Extensions.DependencyInjection is much easier, too. (At least for MVC-Web-Applications) you don't need unity anymore.

这篇关于Unity 容器和对 dotnet Core/netstandard 的支持的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆