示例#1
0
        public GraphBuilder(PluginGraph pluginGraph)
        {
            _pluginGraph = pluginGraph;
            _assemblyScanner = new AssemblyScanner();

            _instanceReader = new XmlInstanceReader(_pluginGraph.Log, new Registry());
        }
示例#2
0
        public override Instance ReadChildInstance(string name, XmlInstanceReader graph, Type childType)
        {
            ITypeReader reader = TypeReaderFactory.GetReader(childType);
            if (reader == null)
            {
                return base.ReadChildInstance(name, graph, childType);
            }

            XmlElement element = _element[name];
            return element == null ? null : reader.Read(element, childType);
        }
 public InstanceMementoPropertyReader(ConstructorInstance instance, InstanceMemento memento, XmlInstanceReader reader)
 {
     _instance = instance;
     _memento = memento;
     _reader = reader;
 }
        protected virtual Instance readInstance(XmlInstanceReader reader, Type pluginType)
        {
            if (IsDefault)
            {
                return new DefaultInstance();
            }

            if (IsReference)
            {
                return new ReferencedInstance(ReferenceKey);
            }

            throw new NotImplementedException("build out with XmlInstanceReader");

            //return new ConfiguredInstance(this, reader, pluginType);
        }
        public Instance ReadInstance(XmlInstanceReader reader, Type pluginType)
        {
            try
            {
                Instance instance = readInstance(reader, pluginType);
                instance.Name = InstanceKey;

                return instance;
            }
            catch (StructureMapException)
            {
                throw;
            }
            catch (Exception e)
            {
                throw new StructureMapException(260, e, InstanceKey, pluginType.FullName);
            }
        }
 public virtual Instance ReadChildInstance(string name, XmlInstanceReader graph, Type childType)
 {
     InstanceMemento child = GetChildMemento(name);
     return child == null ? null : child.ReadInstance(graph, childType);
 }