Пример #1
0
        public void Eject(Type pluginType, Instance instance)
        {
            var key = new InstanceKey(instance, pluginType);
            if (!_objects.Has(key)) return;

            var disposable = _objects[key] as IDisposable;
            _objects.Remove(key);
            disposable.SafeDispose();
        }
Пример #2
0
 public bool Equals(InstanceKey obj)
 {
     if (ReferenceEquals(null, obj))
     {
         return(false);
     }
     if (ReferenceEquals(this, obj))
     {
         return(true);
     }
     return(Equals(obj.Name, Name) && Equals(obj.PluginType, PluginType));
 }
Пример #3
0
        public void Eject(Type pluginType, Instance instance)
        {
            var key = new InstanceKey(instance, pluginType);

            if (!_objects.Has(key))
            {
                return;
            }

            var disposable = _objects[key] as IDisposable;

            _objects.Remove(key);
            disposable.SafeDispose();
        }
Пример #4
0
        public void Set(Type pluginType, Instance instance, object value)
        {
            if (value == null) return;

            try
            {
                var key = new InstanceKey(instance, pluginType);
                _objects[key] = value;
            }
            catch (ArgumentException e)
            {
                string message = string.Format("Duplicate key for Instance {0} of PluginType {1}", instance.Name,
                                               pluginType.AssemblyQualifiedName);
                throw new ArgumentException(message, e);
            }
        }
Пример #5
0
        public void Set(Type pluginType, Instance instance, object value)
        {
            if (value == null)
            {
                return;
            }

            try
            {
                var key = new InstanceKey(instance, pluginType);
                _objects[key] = value;
            }
            catch (ArgumentException e)
            {
                string message = string.Format("Duplicate key for Instance {0} of PluginType {1}", instance.Name,
                                               pluginType.AssemblyQualifiedName);
                throw new ArgumentException(message, e);
            }
        }
Пример #6
0
        public object Get(Type pluginType, Instance instance)
        {
            var key = new InstanceKey(instance, pluginType);

            return(_objects.Has(key) ? _objects[key] : null);
        }
Пример #7
0
        public bool Has(Type pluginType, Instance instance)
        {
            var key = new InstanceKey(instance, pluginType);

            return(_objects.Has(key));
        }
Пример #8
0
 public bool Equals(InstanceKey obj)
 {
     if (ReferenceEquals(null, obj)) return false;
     if (ReferenceEquals(this, obj)) return true;
     return Equals(obj.Name, Name) && Equals(obj.PluginType, PluginType);
 }
Пример #9
0
 public bool Has(Type pluginType, Instance instance)
 {
     var key = new InstanceKey(instance, pluginType);
     return _objects.Has(key);
 }
Пример #10
0
 public object Get(Type pluginType, Instance instance)
 {
     var key = new InstanceKey(instance, pluginType);
     return _objects.Has(key) ? _objects[key] : null;
 }