Ejemplo n.º 1
0
        public void ForMemento(InstanceMemento memento, Action<Registry, Instance> callback)
        {
            ForType(memento.PluggedType, concreteType =>
            {
                // TODO -- gotta catch errors here

                _log.Try(() =>
                {
                    var instance = new ConstructorInstance(concreteType);
                    instance.Name = memento.InstanceKey;

                    // TEMPORARY
                    Plugin plugin = PluginCache.GetPlugin(concreteType);
                    var reader = new InstanceMementoPropertyReader(instance, memento, this);
                    plugin.VisitArguments(reader);

                    callback(_registry, instance);
                }).AndLogAnyErrors();
            });
        }
 public InstanceMementoPropertyReader(ConstructorInstance instance, InstanceMemento memento, XmlInstanceReader reader)
 {
     _instance = instance;
     _memento = memento;
     _reader = reader;
 }
 /// <summary>
 /// Links an array of InstanceMemento's to a named array property
 /// </summary>
 /// <param name="name"></param>
 /// <param name="childMementos"></param>
 public void AddChildArray(string name, InstanceMemento[] childMementos)
 {
     _children.Add(name, childMementos);
 }
 /// <summary>
 /// Links a child InstanceMemento as a named property
 /// </summary>
 /// <param name="name"></param>
 /// <param name="Memento"></param>
 public void AddChild(string name, InstanceMemento Memento)
 {
     _children.Add(name, Memento);
 }