This project is read-only.
!Attributed Definition Provider
This much like the attributed model which is a part of the model shipped with MEF by Microsoft, but it’s been created to be compatible with the features of the provider model. In Preview 1 this definition provider is experimental and subject to change. It is however, a fully functional provider which can be used in your projects.

One important distinction from the attributed declarations in the default MEF model is that the attributed provided translates a contract type into a string containing the assembly qualifies name, instead of just the name which is done in the default model. Most of the time this probably won’t have any effect on your project but it’s a good thing to be aware of.

The definition provider relies on two declarative attributes called Importable and Exportable, which are the counterparts of the Import and Export attribute found in the default model, with the added functionality provided by the provider model.

The following is an example of how the attributes can be used to define an import and an export.

Public class Host
  public Export<IMessageService> Service { get; set; }

public class NullMessageService : IMessageService

To create a DefinitionProviderPartCatalog instance for the AttributedDefinitionProvider you would do the following.

var a =

var attributeCatalog =
  new DefinitionProviderPartCatalog<AttributedDefinitionProvider>(a);

The catalog is then added to the container just like any other catalog.

Last edited Mar 1, 2009 at 2:11 PM by TheCodeJunkie, version 1


No comments yet.