About .NET, ASP.NET, MVC, C#, WPF, WCF and everything related to .NET and more.

Mugen Injection [Binding events]

The MugenInjection exposes events that can be hooked at various stages in instance lifecycle:

  • OnActivating - called before a component is used.
  • OnActivated - called once a component is fully constructed. Here you can perform application-level tasks that depend on the component being fully constructed - these should be rare.
  • OnReleaseObject - called before instances will be released, Here you can perform cleanup for a component.
  • OnDisposed - executes callback method after binding disposed.
These are subscribed to during binding registration:
// Create your MugenInjector.
_injector = new MugenInjector();
    .OnActivating(context => context.Parameters.Add(new ConstructorParameter("test", "test")))
    .OnActivated(beta => beta.Test())
    .OnDisposed(binding => {})
    .OnReleaseObject((beta, b) => beta.CustomDispose());

Leave a Reply
* Bullet List
** Bullet List 2
# Number List
## Number List 2
{"Do not apply formatting"}
{code:language} code here {code:language}.
Supports: aspx c#, c#, c++, html, sql, xml