/// <summary> /// Gets the default instance of type T using the explicitly configured arguments from the "args" /// </summary> /// <typeparam name="T"></typeparam> /// <param name="args"></param> /// <returns></returns> public IEnumerable <T> GetAllInstances <T>(ExplicitArguments args) { try { var session = new BuildSession(_pipelineGraph, BuildSession.DEFAULT, args); return(session.GetAllInstances <T>()); } catch (StructureMapException e) { e.Push("Container.GetAllInstances<{0}>({1})", typeof(T).GetFullName(), args); throw; } }
/// <summary> /// Creates or resolves all registered instances of type T /// </summary> /// <typeparam name="T"></typeparam> /// <returns></returns> public IEnumerable <T> GetAllInstances <T>() { try { var session = new BuildSession(_pipelineGraph); return(session.GetAllInstances <T>()); } catch (StructureMapException e) { e.Push("Container.GetAllInstances<{0}>()", typeof(T).GetFullName()); throw; } }
/// <summary> /// Creates a new instance of the requested type using the supplied Instance. Mostly used internally /// </summary> /// <param name="pluginType"></param> /// <param name="instance"></param> /// <returns></returns> public object GetInstance(Type pluginType, Instance instance) { try { var session = new BuildSession(_pipelineGraph, instance.Name); return(session.FindObject(pluginType, instance)); } catch (StructureMapException e) { e.Push("Container.GetInstance({0}, Instance: {1})", pluginType.GetFullName(), instance.Description); throw; } }
private object buildInstanceWithArgs(Type pluginType, Instance defaultInstance, ExplicitArguments args, string requestedName) { if (defaultInstance == null && pluginType.IsConcrete()) { defaultInstance = new ConfiguredInstance(pluginType); } var basicInstance = defaultInstance as IConfiguredInstance; var instance = basicInstance == null ? defaultInstance : basicInstance.Override(args); var session = new BuildSession(_pipelineGraph, requestedName, args); return(session.FindObject(pluginType, instance)); }
private object buildInstanceWithArgs(Type pluginType, Instance defaultInstance, ExplicitArguments args, string requestedName) { if (defaultInstance == null && pluginType.IsConcrete()) { defaultInstance = new ConfiguredInstance(pluginType); } var basicInstance = defaultInstance as ConstructorInstance; Instance instance = basicInstance == null ? defaultInstance : basicInstance.Override(args); BuildSession session = withNewSession(requestedName); args.RegisterDefaults(session); return(session.CreateInstance(pluginType, instance)); }
public object BuildNewInOriginalContext(Type pluginType, Instance instance) { var session = new BuildSession(pipelineGraph.Root(), requestedName: instance.Name); return(session.BuildNewInSession(pluginType, instance)); }
/// <summary> /// Creates or resolves all registered instances of type T /// </summary> /// <typeparam name="T"></typeparam> /// <returns></returns> public IList <T> GetAllInstances <T>() { BuildSession session = withNewSession(Plugin.DEFAULT); return(getListOfTypeWithSession <T>(session)); }
/// <summary> /// Creates a new instance of the requested type using the supplied Instance. Mostly used internally /// </summary> /// <param name="pluginType"></param> /// <param name="instance"></param> /// <returns></returns> public object GetInstance(Type pluginType, Instance instance) { var session = new BuildSession(_pipelineGraph, instance.Name); return(session.FindObject(pluginType, instance)); }
/// <summary> /// Creates or resolves all registered instances of type T /// </summary> /// <typeparam name="T"></typeparam> /// <returns></returns> public IEnumerable <T> GetAllInstances <T>() { var session = new BuildSession(_pipelineGraph); return(session.GetAllInstances <T>()); }
public IEnumerable <T> GetAllInstances <T>(ExplicitArguments args) { var session = new BuildSession(_pipelineGraph, Plugin.DEFAULT, args); return(session.GetAllInstances <T>()); }