Choosing between MEF and MAF (System.AddIn)

前端 未结 7 2087
伪装坚强ぢ
伪装坚强ぢ 2020-11-22 10:05

The Managed Extensibility Framework (MEF) and Managed AddIn Framework (MAF, aka System.AddIn) seem to accomplish very similar tasks. According to this Stack Overflow questio

相关标签:
7条回答
  • 2020-11-22 11:10

    In my view the two technologies actually target very different use cases.

    MEF is typically best in a pure dependency injection scenario where the person or group delivering the final integrated solution is assembling everything and vouching for the overall integrity but has a need to have different implementations of key capabilities.

    MAF is for a scenario where someone/group is developing a platform or host and other groups will add capabilities after the fact and in a way not under the control of the host group. In this scenario the need is for more elaborate mechanisms to "protect" the host from rogue add-ins (or to protect add-ins from each other).

    A third similar-in-pattern technology is the whole ProviderBase scheme. This also enables replacing a capability but its goal is really the scenario where the host/app absolutely needs a capability and the need is really to specify different implementations via config.

    0 讨论(0)
提交回复
热议问题