Search code examples
dependency-injectioninversion-of-controlgrace-ioc

Running code after creating object with Grace IoC


I'd like to call a method on an object after it's been created and all of the dependencies have been loaded, but before it's returned to the caller of Locate() . How can I do this?


Solution

  • Starting in 6.3.0 you have the ability to apply cross cutting functionality using the ExportInitialize extension

    container.Configure( c => c.ExportInitialize<ISomeInterface>(instance => instance.SomeMethod()));