public void LifetimeTests_StateCheck() { var scoped = new ScopedLifetime(); Assert.IsInstanceOfType(scoped.Create(), typeof(ScopedLifetime)); var singleton = new SingletonLifetime(); Assert.IsInstanceOfType(singleton.Create(), typeof(SingletonLifetime)); }
private ScopedLifestyle GetScopedLifestyle(ScopedLifetime scopedLifetime) { switch (scopedLifetime) { case ScopedLifetime.WebApiRequest: return(new WebRequestLifestyle()); case ScopedLifetime.ThreadScoped: return(new ThreadScopedLifestyle()); case ScopedLifetime.AsyncScoped: return(new AsyncScopedLifestyle()); default: return(null); } }
public DependencyInjector(ScopedLifetime scopedLifetime) : this(ObjectLifetime.Scoped) { _scopedLifetime = scopedLifetime; }