项目 - 嵌入式IoC容器 [英] Project-Embedded IoC Container

查看:220
本文介绍了项目 - 嵌入式IoC容器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要寻找一个非常简单和轻巧的IoC容器的的C#源代码可以被包含在我自己的项目的(因此不能使外部参考)。

I am looking for a really simple and lightweight IoC Container whose C# source can be included in my own project (thus not making an external reference).

这样做的原因是,我写的基础设施,并愿意提供一个.dll文件,无需任何额外的依赖。

The reason for this is that I am writing an infrastructure and would like to provide a single .dll file, without any additional dependencies.

我也不想ILMerge我的组装与IOC大会。

I also do not want to ILMerge my assembly with the IoC assembly..

我想到了MEF,其他一些建议吗?

I thought about MEF, some other suggestions?

推荐答案

如果您使用的是.NET 4.0,你有MEF包括在内。

If you're using .NET 4.0 you have MEF included.

对于.NET 2我曾经写过使用接口与思考类似的东西。有很多的教程在那里描述该过程。即使你可以使用MEF,它还是值得尝试的一些反思教程,因为这是MEF是如何工作的下面。

For .NET 2 I once wrote something similar using interfaces and Reflection. There are a lot of tutorials out there describing that process. Even if you can use MEF, its still worth attempting some reflection tutorials as this is how MEF works underneath.

另外,请查阅其中有一些很好的回答这个问题 TinyIoC 看起来像它只是一个单一的源文件。

Also check out this question which has some good answers. TinyIoC looks like its just a single source file.

这篇关于项目 - 嵌入式IoC容器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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