Skip to content
Ian Johnson edited this page Jul 2, 2018 · 2 revisions

To automatically populate these properties for everything in the container, call the following:

container.Configure(
    c => c.ImportMembers<object>(MembersThat.HaveAttribute<ImportAttribute>()));

If you only need to use it for a single type, you can do it during the type registration:

container.Configure(
    c => c.Export<Logger>()
        .ImportMembers(MembersThat.HaveAttribute<ImportAttribute>())
        .As<ILogger>());
Clone this wiki locally