public static IContainer Initialize(Assembly assembly = null) { var container = new Container(x => { DoIoCInit(x, assembly); }); InternalDependencyResolver.SetRootContainer(container); DoStartup(container); return(container); }
public IDependencyScope BeginScope() { // Nested scope will likely already be created on Application_BeginRequest // So call the *IfNeeded version var scopeDisposer = InternalDependencyResolver.BeginScopedLifecycleIfNeeded(); return(new StructureMapDependencyScope(scopeDisposer)); }
public IEnumerable <object> GetServices(Type serviceType) => InternalDependencyResolver.GetAllInstances(serviceType);
public object GetService(Type serviceType) => InternalDependencyResolver.GetInstance(serviceType);
public void Dispose() => InternalDependencyResolver.Dispose();
public static void DoEndRequest() { InternalDependencyResolver.EndScopedLifecycle(); }
public static void DoBeginRequest() { InternalDependencyResolver.BeginScopedLifecycle(); }
public static void RegisterPerRequest <TPluginType, TConcrete>(this ConfigurationExpression x) where TConcrete : TPluginType { // The dependency resolver will always resolve per http request or command processor message x.For <TPluginType>().Use(() => InternalDependencyResolver.GetInstance <TConcrete>()); }