Skip to content

Instantly share code, notes, and snippets.

@bhameyie
Created February 1, 2014 00:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bhameyie/8746042 to your computer and use it in GitHub Desktop.
Save bhameyie/8746042 to your computer and use it in GitHub Desktop.
Sample Metadata for ASP.NET WebAPi service composition
[Export(typeof(IComposableApiMetadata))]
public class ExternalApiMetadata : IComposableApiMetadata {
public void Compose(ContainerBuilder builder) {
builder.Register(e => new BookRepository()).As<IBookRepository>().InstancePerApiRequest();
}
public Assembly ApiAssembly() {
return typeof(BooksController).Assembly;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment