Skip to content

Instantly share code, notes, and snippets.

@jbogard
Created March 19, 2012 13:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jbogard/2112149 to your computer and use it in GitHub Desktop.
Save jbogard/2112149 to your computer and use it in GitHub Desktop.
public abstract class TestClassBase
{
private readonly IContainer _container
= Root.Container.GetNestedContainer();
protected T GetInstance<T>()
{
return _container.GetInstance<T>();
}
protected void Inject<T>(T instance)
{
_container.Configure(cfg => cfg.For<T>().Use(instance));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment