2

I am currently working in a game platform application. I want to be able to easily add new games to it, but the games should be comply with a particular contract :

  • The games must have some required methods
  • They must receive some events provided by the main program
  • They must be able to send some data back to the program
  • It would be wonderful if it is easy for external developers to make games for the platform, just by having knowledge of the interface

I read some questions like MEF vs MAF, and at first I would think that MAF is better for me, but I am not sure of that. Plus, I think I could even make some kind of homemade system like, compiling games as DLLs and retrieve them at runtime.

MAF seems good because of the isolation, but since I am not really working with little add-in, and as I read, MAF is heavy and lacks speed, I have many doubts of what I should use.

Should I try MAF, even if it can be slow, and hard to develop, and does it really suits to what I am doing ?

4

1 回答 1

4

这可能不是您的完整答案,但我会加入我确实有经验的 MEF(我对 MAF 没有真正的经验)。MEF 有很多优点,我认为它们适合您的需求。

MEF 是轻量级的,而且非常易于使用。它提供了依赖注入。

发现的东西很容易使用。只需创建您的目录,您就可以开始运行了。

MEF 使插件体系结构变得非常简单。我完全同意了。

虽然 MAF 可以提供隔离,但您必须使东西可远程调用以跨应用程序域调用,这很麻烦。为了防止未处理的异常退出您的主应用程序,您必须在它们自己的进程中创建加载项,这有其自身的局限性。例如,如果您想在加载项之间共享 DLL,则它们需要与共享 DLL 位于同一目录中,或者共享 DLL 需要位于 GAC 中。

于 2013-01-03T20:57:33.093 回答