public void BuildUp(object target) { var pluggedType = target.GetType(); var instance = _pipelineGraph.GetDefault(pluggedType) as IConfiguredInstance ?? new ConfiguredInstance(pluggedType); // TODO -- do this by pulling SetterRules out of PluginGraph var builder = _pipelineGraph.Outer.BuilderFor(pluggedType); var arguments = new Arguments(instance, this); builder.BuildUp(arguments, target); }
public object TryGetDefault(Type pluginType, IPipelineGraph pipelineGraph) { if (_defaults.ContainsKey(pluginType)) { return(_defaults[pluginType]); } var instance = pipelineGraph.GetDefault(pluginType); if (instance == null) { return(null); } var o = GetObject(pluginType, instance); _defaults.Add(pluginType, o); return(o); }
public object GetDefault(Type pluginType, IPipelineGraph pipelineGraph) { if (_defaults.ContainsKey(pluginType)) { return(_defaults[pluginType]); } var instance = pipelineGraph.GetDefault(pluginType); if (instance == null) { throw new StructureMapException(202, pluginType); } var o = GetObject(pluginType, instance); if (!instance.IsUnique()) { _defaults.Add(pluginType, o); } return(o); }
public Instance GetDefault(Type pluginType) { return(_outer.HasDefaultForPluginType(pluginType) ? _outer.Families[pluginType].GetDefaultInstance() : _parent.GetDefault(pluginType)); }