简体   繁体   English

在.NET Core(或ASP.NET 5)中是否有MEF的替代品

[英]Is there a replacement for MEF in .NET Core (or ASP.NET 5)

We know that .NET Core (the open-source components) are only a subset of the full .NET Framework, and that ASP.NET 5 (and MVC 6) is built on .NET Core. 我们知道.NET Core(开源组件)只是完整.NET Framework的一个子集,而ASP.NET 5(和MVC 6)是基于.NET Core构建的。 Does this mean that Managed Extensibility Framework (MEF) is not available in ASP.NET 5? 这是否意味着ASP.NET 5中没有Managed Extensibility Framework(MEF)?

If so, is there any replacement for dynamic extensibility available in .NET Core? 如果是这样,.NET Core中是否有可用的动态可扩展性替换?

I have a number of applications that use MEF to dynamically load plugins and external integrations and it would be a pity if they were locked into the .NET Framework just because they use MEF. 我有许多使用MEF来动态加载插件和外部集成的应用程序,如果他们因为使用MEF而被锁定在.NET Framework中,那将是一个遗憾。

The existing NuGet package should work. 现有的NuGet包应该可以工作。 It's portable, and .NET Core is a backward-compatible evolution of the portable API surface. 它是可移植的,.NET Core是便携式API表面的向后兼容演进。 ASP.NET Core won't automatically install it, however because the package doesn't explicitly say that it's compatible with .NET Core. ASP.NET Core不会自动安装它,但是因为该软件包没有明确表示它与.NET Core兼容。

To install the package, you'll need to add an imports section to your project.json : 要安装软件包,您需要在project.json添加一个imports部分:

{
  "dependencies": {
    "Microsoft.Composition": "1.0.30"
  },
  "frameworks": {
    "netcoreapp1.0": {
      "imports": "portable-net45+win8"
    }
  }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM