Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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