What’s new in MEF 2 Preview 5? [Alok, Nick]

What’s new in MEF 2 Preview 5? [Alok, Nick]

Rate This
  • Comments 8

Nearly two months since we published MEF 2 Preview 4, we have just posted our fifth preview on the MEF CodePlex site.

The new preview has been shaped by your feedback; everyone who took the time to download, evaluate or comment on the last version, thank you!

So, what has changed since Preview 4?

  • CompositionException.RootCauses, previously only visible in the debugger, can now be accessed directly in code
  • Using RegistrationBuilder, all interfaces on a part can now be exported using the ExportInterfaces method
  • IDisposable and IPartImportsSatisfiedNotification will now be filtered out by RegistrationBuilder automatically (these should never be exported)
  • CompositionProvider in the ASP.NET MVC integration now exposes ApplicationSharedPartMetadataKey for those wishing to create their own sharing conventions compatible with the provider
  • Some additional performance tuning has been done

As we get closer to making our next supported release as part of the .NET Framework, the bar is now high for changes to be included in MEF 2. Even so, we’d love to hear about your experiences with the new preview, and planning for MEF 3 is just around the corner. You can get in touch via this blog or through the discussion forum and issue tracker on CodePlex.

  • Hi,

    if MEF 3 is about to enter planning stage, I have a long standing feature request.

    I've always wanted an easier way to create scoped containers in MEF.

    MEF 2 is getting there but not quite as easy as I'd like it to be for some scenarios.

    My Ideea was to add a third creating policy option: CreationPolicy.ScopeShared, that acts as Shared does but only at container level, any time a child container is created all the parts decorated with ScopeShared wll be recreated by the ChildContainer and will have their lifetime bound to the child container's lifetime.

    In my view this can greatly simplify a whole heap of scenarios: ( IE: containers are scoped per document )  and would be very easy to use, following current lifetime management pattern given by CreationPolicy.

    Catalin

  • Hello, I agree with the request for easy scoping.

    One more thing is that MEF bring the good of both extensibility and easy of development (and testing).

    In the easy of development it start to look like Google Guice and I think it will only be smart to mimic the good parts like scoping and factory pattern called AssistedInject. This can be done manually but will reduce boilerplate code if done inside the framework.

    Thanks for the great job.

    Ido

  • Is MAF still viable?

  • I tried to reference the dlls in my Silverlight project and it would not let me because it said they had not been compiled against the Silverlight Runtime

  • Thanks for great features in MEF 2.

    Why don't you publish MEF via NuGet?

  • Is there currently any support for MEF in the Windows 8 runtime?

  • @Catalin/@Ido thanks for the feedback.

    @Alex MAF and MEF have different purposes, MAF is recommended where plugins must be isolated, however the cost of doing so is that the programming model is more heavyweight than what can be achieved with MEF. Whether you use one or the other, or a combination of the two, depends very much on your scenario.

    Anonymous commenter - yes, sorry, the recent previews are .NET Framework only. On Silverlight you should find that System.ComponentModel.Composition is part of the SDK already, and includes some features only now available on the full framework e.g. ExportFactory.

    @Perym we've announced that MEF2's support for ASP.NET MVC will be shipped via NuGet. We are actively investigating how we can utilize NuGet more - there are some challenges because the core of MEF is a part of the full .NET framework, but we have identified some opportunities and will do our best to take advantage of them.

    @Albino Visual Studio 11 Developer Preview allows you to reference MEF (split between a number of System.ComponentModel.Composition.* DLLs) when targeting Metro style applications. For details see: msdn.microsoft.com/.../hh454035(v=vs.110).aspx

  • I am looking for a simple wpf application built on mvvm pattern and use wep. I havent found any sample in the releases. And code i found on the internet are very complex as they contain many things. Can you put up a simple wpf application on mvvm using mef in next release samples.

    Thanks,

Page 1 of 1 (8 items)