You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ian Johnson edited this page Sep 9, 2017
·
4 revisions
Grace provides a number of extension points for applying configuration across all export strategies.
ImportMembers
To import all members of a specific type you can call ImportMember<T>. For more granularity supply a MembersThat filter.
// import all public properties and fields of type ILoggercontainer.Configure(c =>c.ImportMembers<ILogger>());// import all int properties that end with Idcontainer.Configure(c =>c.ImportMembers<int>(MembersThat.EndWith("Id")));
ExportInitialize
Apply cross cutting initialization logic to all exports of a particular type.
// execute SomeMethod on all types that implement ISomeInterfacecontainer.Configure(
c =>c.ExportInitialize<ISomeInterface>(instance =>instance.SomeMethod());
IActivationStrategyInspector
Sometimes it's useful to inspect each activation strategy that is registered. You can manipulate things such as priority, exported types, import properties and more.
An IInjectionValueProvider can be provided and will be called for every dependency that is located allow a custom expression to be used. One example of this feature being used is by the MVC model binding support.