Own extensibility layer or MEF/MAF?
For those that work with application extensibility in .NET, what do you prefer doing - creating your own extensibility layer or using MEF (Managed Extensibility Framework) or MAF (Managed Add-in Framework)开发者_如何学Go?
So far, I've used both ways of implementing application extensibility and I like MEF for the fact that it makes it easier to load existing assemblies from a specific location without directly verifying for interface implementations (for the lack of an ImplementationOf(interface)
check in .NET).
What are the advantages that you see in your specific extensibility layer preference? What are the disadvantages?
MEF certainly has a lot of advantages, most of what you mentioned ... extensibility, modularity, lifetime management, and anything else I'd want available in a first class framework. It also is shipped with the framework, so there's nothing exta to do and you know it will be consistent across implementations.
It's used in VS 2010 so there couldn't be a more broadly used real world example in play.
MAF isn't really the same thing. It is very specific to System.AddIn and has some more rigid requirements and contracts to satisfy. Having said that, it also specifically targets a particular type of extensibility that some people may want.
I would only go for a custom approach if I had a really small footprint or application that just didn't need all of the additional overhead.
精彩评论