public static SimpleInjector.Container PrepareSimpleInjector() { var c = new SimpleInjector.Container(); c.Options.DefaultScopedLifestyle = new AsyncScopedLifestyle(); c.Register <Parameter1>(Lifestyle.Singleton); c.Register <Parameter2>(Lifestyle.Singleton); c.Register <Parameter3>(Lifestyle.Scoped); c.Register <ScopedBlah>(Lifestyle.Scoped); return(c); }
public static object Measure(SimpleInjector.Container container) { using (AsyncScopedLifestyle.BeginScope(container)) return(container.GetInstance <ScopedBlah>()); }