Posts Tagged MEF
MEF Preview 5
Posted by Rohland in Development on April 23, 2009
Just upgraded to MEF preview 5 and thought I would just post a gotcha that had me puzzled for a few minutes. After upgrading none of my exported parts were being picked up after composing an instance of the composition container class. I was exporting my types as per the example below:
1 [Export("DataTransformation.Task")]
2 public class Task : DataTransformationTask
3 {
4 // ….
5 }
With MEF preview 5 you have to explicitly pass the type you are exporting in the Export attribute constructor as per below:
1 [Export("DataTransformation.Task", typeof(DataTransformationTask))]
2 public class Task : DataTransformationTask
3 {
4 // ….
5 }
If you would like to find out what else has changed I would recommend taking a read through Glenn Block’s blog review here: http://codebetter.com/blogs/glenn.block/archive/2009/04/11/mef-preview-5-changes-and-enhancements.aspx

What people are saying