是MEF的OSGi的.NET? [英] Is MEF OSGi for .NET?

查看:232
本文介绍了是MEF的OSGi的.NET?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是试图让我的头周围的托管扩展性框架(的MEF )的时刻,挖掘到一点。我有一个Eclipse背景,使我的大脑我目前有公式:

I'm just trying to get my head around the Managed Extensibility Framework (MEF) at the moment and digging into a bit. I have an Eclipse background so in my brain I currently have the equation:

MEF =〜的OSGi的。NET

根据我所听到为止。我是在正确的方向?

Based on what I have heard so far. Am I on the right lines?

推荐答案

在Scott Hanselman有助于突出有关MEF的细节在他的<一个href="http://www.hanselman.com/blog/HanselminutesPodcast148MEFManagedExtensibilityFrameworkWithGlennBlock.aspx">podcast 148 与格伦块。

Scott Hanselman helped to highlights the specifics about MEF in his podcast 148 with Glenn Block.

相较于OSGi的,MEF是建立在控制反转和 OSGi的是不是:它(OSGi的)会通过基于一个生命周期层不同的机制,探索新的软件包。

Compared to OSGi, MEF is built upon "Inversion of Control" and OSGi is not: it (OSGi) will discover new bundle through a different mechanism based on a Life Cycle Layer.

MEF 是专注于应用程序的可扩展性。它采用DI作为一个战略组成不同的扩展,但它本身并不是一个通用的DI容器的。

MEF is focused on application extensibility. It uses DI as a strategy for composing the different extensions, however it is not in itself a generic DI container.

由于最后一点可能会造成混淆,在成绩单播客的可以帮助:

Since the last point can be confusing, the transcripts of the podcast can help:

我的方式基本上,虽然其定位,两者的区别是,IoC容器中,真的是有关管理的的一套东西在不同的环境,就像我想在我的磁盘环境记录仪,我想在我的测试环境中模拟记录仪。

The way I basically position it though, the difference between the two, is that IoC containers are really about managing a known set of things in different environments, like I want a logger in my disk environment, I want a mock logger in my test environment.

所以,MEF实际上是一种管理的未知的那套东西,什么归结为是,在IoC容器我倾向于做任何一个公约为基础或注册,具体注册机制,这里要说的记录意味着什么,这里就是这个意思,这里是什么意思。

So MEF is really about managing an unknown set of things and what that boils down to is that in an IoC Container I tend to do either a convention-based or a registration, specific registration mechanism, to say here's what logger means, here's what this means, here's what that means.

MEF使用code和在code发现机制和注释,这是   属性,其中无论在系统中显示出来,这是那里的东西。

MEF uses the code and a discovery mechanism and annotations on the code, which are attributes, where whatever shows up in the system, that's what's there.

所以,再一次把它到一个更高的水平,这是关于你使用MEF真正管理一组的未知的东西,你用IOC容器来管理一组的的事情。

So again, taking it to a higher level, it's about you use MEF to really manage a set of unknown things, you use IoC Containers to manage a set of known things.

结论:(之一)的主要区别在于发现原则(IoC的与生命周期)

Conclusion: (one of) the main difference is the discovery principle (IoC vs. lifecycle)

这篇关于是MEF的OSGi的.NET?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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