Example #1
0
        private static void SyncComponent(Component component, IComponentInfo schema)
        {
            component.Schema = schema;

            // Delete existing properties that don't have a corresponding definition.
            // and are not system properties (starting with $) or hidden ones (starting with _)
            component.Properties
                .Where(p => !p.Name.StartsWith("$") && !p.Name.StartsWith("_") && !schema.Properties.Any(info => info.Name == p.Name))
                .ToArray()
                .ForEach(p => p.Delete());

            // Initialize all the new properties. Existing ones are not modified.
            foreach (var propertySchema in schema.Properties)
            {
                var property = component.Properties.FirstOrDefault(x => x.Name == propertySchema.Name);
                if (property != null)
                {
                    property.Schema = propertySchema;
                }
                else
                {
                    property = component.CreateProperty(propertySchema.Name);
                    property.Schema = propertySchema;
                }

                // NOTE: unlike original NuPattern, we don't eagerly evaluate default values,
                // neither do we persist them.
            }
        }
 /// <inheritdoc/>
 public override void Init(NLite.Mini.Activation.IActivator activator, IKernel kernel, IComponentInfo info, Action<IComponentInfo, object> onDestroying, Action<IComponentContext> onFetch)
 {
     Guard.NotNull(activator, "activator");
     Guard.NotNull(kernel, "kernel");
     Guard.NotNull(info, "info");
     Real.Init(new ProxyActivator(activator), kernel, info, onDestroying,OnFetch);
 }
Example #3
0
        /// <summary>
        /// Gets the requested service.
        /// </summary>
        public object GetService(Type serviceType)
        {
            // 0) request for service provider ?
            if (serviceType is IServiceProvider)
            {
                return(this);
            }

            // 1) find IComponentInfo for this type
            IComponentInfo cInfo = Config.Components[serviceType];

            if (cInfo == null)
            {
                return(null);
            }

            // 2) singleton and already instantiated ?
            if (cInfo.Singleton)
            {
                object serviceInstance = FindServiceInstance(serviceType);
                if (serviceInstance != null)
                {
                    return(serviceInstance);
                }
            }

            // 3) create instance
            object instance = CreateInstance(cInfo);


            return(instance);
        }
Example #4
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="kernel"></param>
 /// <param name="info"></param>
 /// <param name="args"></param>
 /// <param name="genericParameters"></param>
 public ComponentContext(IKernel kernel, IComponentInfo info, IDictionary <string, object> args, Type[] genericParameters)
 {
     Kernel            = kernel;
     Component         = info;
     NamedArgs         = args;
     GenericParameters = genericParameters;
 }
Example #5
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="info"></param>
 /// <param name="instance"></param>
 public override void OnPreDestroy(IComponentInfo info, object instance)
 {
     if (instance != null && instance != Manager)
     {
         Manager.ForEach(listner => listner.OnDestroying(instance));
     }
 }
Example #6
0
        private bool HasMatch(IComponentInfo info)
        {
            //得到所有切点
            var pointCuts = Aspect.GetPointCuts(info.Implementation);

            if (pointCuts == null || pointCuts.Length == 0)
            {
                return(false);
            }

            //得到所有Advice
            var advices = Aspect.GetAdvices(pointCuts);

            if (advices.Count == 0)
            {
                return(false);
            }

            //得到所有的接入点
            var joinPoints = Aspect.GetJointPoints(info.Implementation, info.Contracts, pointCuts);

            if (joinPoints == null || joinPoints.Count == 0)
            {
                return(false);
            }

            Aspect.RegisterJointPoints(info.Implementation, joinPoints, advices);

            info.ExtendedProperties["interceptors"] = advices.Values.Distinct().ToArray();
            info.ExtendedProperties["methods"]      = joinPoints.Select(p => p.Key).Distinct().ToArray();

            return(true);
        }
Example #7
0
 void IComponentListener.OnPreDestroy(IComponentInfo info, object instance)
 {
     if (Enabled && PreDestroy != null)
     {
         PreDestroy(info, instance);
     }
 }
Example #8
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="kernel"></param>
 /// <param name="info"></param>
 /// <param name="args"></param>
 /// <param name="genericParameters"></param>
 public ComponentContext(IKernel kernel, IComponentInfo info, IDictionary<string, object> args, Type[] genericParameters)
 {
     Kernel = kernel;
     Component = info;
     NamedArgs = args;
     GenericParameters = genericParameters;
 }
Example #9
0
        public static Lfx.Types.OperationResult RegisterComponent(IComponentInfo componentInfo)
        {
            // Simplemente lo cargo... eso ya registra los tipos
            if (ComponentesCargados.ContainsKey(componentInfo.EspacioNombres) == false)
            {
                Log.Info("Cargando componente " + componentInfo.EspacioNombres);
                var Res = componentInfo.Load();
                if (Res.Success == false)
                {
                    return(Res);
                }

                // Primero ejecuto la función Try, para decidir si cargo el componenten o no
                var TryRes = componentInfo.ComponentInstance.Try();
                if (TryRes.Success)
                {
                    ComponentesCargados.Add(componentInfo.EspacioNombres, componentInfo);

                    var RegTypes = componentInfo.ComponentInstance.GetRegisteredTypes();
                    if (RegTypes != null)
                    {
                        foreach (var Tt in RegTypes)
                        {
                            Log.Info("  Agregando tipo " + Tt.LblType.ToString());
                            RegisteredTypes.Add(Tt);
                        }
                    }
                }
            }

            return(new Lfx.Types.SuccessOperationResult());
        }
Example #10
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="kernel"></param>
 /// <param name="info"></param>
 /// <param name="args"></param>
 /// <param name="genericParameters"></param>
 public ComponentContext(IKernel kernel, IComponentInfo info, object[] args, Type[] genericParameters)
 {
     Kernel            = kernel;
     Component         = info;
     Args              = args;
     GenericParameters = genericParameters;
 }
Example #11
0
        private object Lookup(IComponentInfo info)
        {
            _log.Info("Start build object [{0}].", info.Id);

            try
            {
                IObjectBuildContext ctx = _b.Build(info);
                if (ctx.LifeCycleManagement)
                {
                    _lifecycleContainer[ctx.Instance] = ctx;
                }
                _log.Info("Build object [{0}] success.", info.Id);
                return(ctx.Instance);
            }
            catch (ObjectBuilderException)
            {
                _log.Warning("Build object [{0}] fail.", info.Id);
                throw;
            }
            catch (ManifestException)
            {
                _log.Warning("Build object [{0}] fail.", info.Id);
                throw;
            }
            catch (Exception ex)
            {
                _log.Warning("Build object [{0}] fail.", info.Id);
                ex.CreateWrapException <ObjectBuilderException>();
                return(null);
            }
        }
Example #12
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="kernel"></param>
 /// <param name="info"></param>
 /// <param name="args"></param>
 /// <param name="genericParameters"></param>
 public ComponentContext(IKernel kernel, IComponentInfo info, object[] args, Type[] genericParameters)
 {
     Kernel = kernel;
     Component = info;
     Args = args;
     GenericParameters = genericParameters;
 }
Example #13
0
        private bool HasMatch(IComponentInfo info)
        {
            //得到所有切点
            var pointCuts = Aspect.GetPointCuts(info.Implementation);

            if (pointCuts == null || pointCuts.Length == 0)
                return false;

            //得到所有Advice
            var advices = Aspect.GetAdvices(pointCuts);

            if (advices.Count == 0)
                return false;

            //得到所有的接入点
            var joinPoints = Aspect.GetJointPoints(info.Implementation,info.Contracts,pointCuts);

            if (joinPoints == null || joinPoints.Count == 0)
                return false;

            Aspect.RegisterJointPoints(info.Implementation, joinPoints, advices);

            info.ExtendedProperties["interceptors"] = advices.Values.Distinct().ToArray();
            info.ExtendedProperties["methods"] = joinPoints.Select(p => p.Key).Distinct().ToArray();

            return true;
        }
Example #14
0
        private Type FindTypeInComponent(IComponentInfo componentInfo, string typeName)
        {
            List <Assembly> allAssemblies = new List <Assembly>();

            allAssemblies.Add(componentInfo.MainAssembly);
            if ((componentInfo.PartAssemblies != null) && componentInfo.PartAssemblies.Any())
            {
                allAssemblies.AddRange(componentInfo.PartAssemblies);
            }

            // Search for the type in all modules of all assemblies belonging to the passed component
            foreach (Assembly assembly in allAssemblies)
            {
                foreach (Module module in assembly.GetModules(false))
                {
                    Type foundType = module.GetType(typeName, false, false);
                    if (foundType != null)
                    {
                        // We have found the type
                        return(foundType);
                    }
                }
            }

            return(null);
        }
Example #15
0
 void IComponentListener.OnPostDestroy(IComponentInfo info)
 {
     if (Enabled && PostDestroy != null)
     {
         PostDestroy(info);
     }
 }
 public override void OnPreDestroy(IComponentInfo info, object instance)
 {
     if (info.Implementation != null)
         Console.WriteLine("OnPreDestroy:" + info.Implementation.Name);
     else
         Console.WriteLine("OnPreDestroy:" + info.Id);
 }
Example #17
0
 void IComponentListener.OnMetadataUnregistered(IComponentInfo info)
 {
     if (Enabled && MetadataUnregistered != null)
     {
         MetadataRegistered(info);
     }
 }
Example #18
0
 /// <inheritdoc/>
 public override void OnPreDestroy(IComponentInfo info, object instance)
 {
     if (resetMap.ContainsKey(instance))
     {
         lock (resetMap)
             resetMap.Remove(instance);
     }
 }
Example #19
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="info"></param>
 /// <param name="instance"></param>
 public override void OnPreDestroy(IComponentInfo info, object instance)
 {
     var dis = instance as IDisposable;
     if (dis != null)
     {
         dis.Dispose();
     }
 }
Example #20
0
 private void ResolveInjectionInfo(IComponentInfo info, Type componentType, string key)
 {
     if (componentType == null)//if (bindingInfo.Implementation != null)
     {
         return;
     }
     new MemberInspector().Inspect(info, Kernel, componentType, key);
 }
Example #21
0
 private bool IsCompatibleComponent(IComponentInfo schema, Type type)
 {
     // Property comparison.
     return type.GetProperties().Where(info => info.Name != "Name" && info.PropertyType.IsNative()).All(info =>
         schema.Properties.Any(prop =>
             prop.Name == info.Name &&
             prop.PropertyType == info.PropertyType));
 }
Example #22
0
        /// <summary>
        /// 在组件元数据注册后进行监听,如果符合代理条件的就在元数据的扩展属性里面添加一个"proxy"标记位
        /// </summary>
        /// <param name="info"></param>
        public override void OnMetadataRegistered(IComponentInfo info)
        {
            Aspect.CheckAndRegisterAspectByInterceptorAttribute(info.Implementation);

            if (HasMatch(info))
                info.ExtendedProperties["proxy"] = true;

            base.OnMetadataRegistered(info);
        }
Example #23
0
        /// <inheritdoc/>
        public override void OnPreDestroy(IComponentInfo info, object instance)
        {
            var startable = instance as IStartable;

            if (startable != null)
            {
                startable.Stop();
            }
        }
        public void Write(IComponentInfo info, XmlWriter writer)
        {
            var move = (MovementComponentInfo)info;

            if (move.EffectInfo != null)
            {
                _effectWriter.Write(move.EffectInfo, writer);
            }
        }
Example #25
0
        internal ObjectBuildContext(IComponentInfo info, IKernal kernal)
        {
            info.ThrowIfNullArgument(nameof(info));
            kernal.ThrowIfNullArgument(nameof(kernal));

            _info               = info;
            _kernal             = kernal;
            _injectedParameters = new List <object>();
        }
Example #26
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="info"></param>
        /// <param name="instance"></param>
        public override void OnPreDestroy(IComponentInfo info, object instance)
        {
            var dis = instance as IDisposable;

            if (dis != null)
            {
                dis.Dispose();
            }
        }
Example #27
0
        private ILifestyleManager CreateProxyLifestyleManager(IComponentInfo info, ILifestyleManager lifestyleMgr)
        {
            if (info.ExtendedProperties.ContainsKey("proxy"))
            {
                lifestyleMgr = new ProxyLifestyleManager(lifestyleMgr);
            }

            return(lifestyleMgr);
        }
Example #28
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="info"></param>
 /// <param name="instance"></param>
 public override void OnPreDestroy(IComponentInfo info, object instance)
 {
     if (info.ExtendedProperties.ContainsKey("MembersRegistered"))
     {
         var exports = info.ExtendedProperties["MembersRegistered"] as IExportInfo[];
         foreach (var item in exports)
             ServiceRegistry.Current.UnRegister(item.Id);
     }
 }
Example #29
0
        internal ObjectBuildContext(IComponentInfo info, IKernal kernal)
        {
            info.ThrowIfNullArgument(nameof(info));
            kernal.ThrowIfNullArgument(nameof(kernal));

            _info = info;
            _kernal = kernal;
            _injectedParameters = new List<object>();
        }
        public void Write(IComponentInfo info, XmlWriter writer)
        {
            var move = (MovementComponentInfo)info;

            if (move.EffectInfo != null)
            {
                _effectWriter.Write(move.EffectInfo, writer);
            }
        }
        internal void WritePart(IComponentInfo info, XmlWriter writer)
        {
            if (!ComponentWriters.ContainsKey(info.GetType()))
                throw new Exception("No xml writer for component type: " + info.GetType().Name);

            var compWriter = ComponentWriters[info.GetType()];

            compWriter.Write(info, writer);
        }
        public void Write(IComponentInfo info, XmlWriter writer)
        {
            var stateComponent = (StateComponentInfo)info;

            foreach (var state in stateComponent.States)
                WriteState(state, writer);

            foreach (var trigger in stateComponent.Triggers.OrderBy(t => t.Trigger.Priority))
                _triggerWriter.WriteMulti(trigger, writer);
        }
Example #33
0
 public bool ReadyToBuild(IComponentInfo info)
 {
     IObjectBuildContext ctx = new ObjectBuildContext(info, _k);
     foreach (IPolicy p in info.BuildPolicies)
     {
         if (!p.ReadyToBuild(ctx))
             return false;
     }
     return true;
 }
        public void Write(IComponentInfo info, XmlWriter writer)
        {
            var spriteComponent = (SpriteComponentInfo)info;

            if (spriteComponent.SheetPath != null)
                writer.WriteElementString("Tilesheet", spriteComponent.SheetPath.Relative);

            foreach (var sprite in spriteComponent.Sprites.Values)
                _spriteWriter.Write(sprite, writer);
        }
Example #35
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="info"></param>
        /// <param name="instance"></param>
        public override void OnPreDestroy(IComponentInfo info, object instance)
        {
            var key = reinjectionMap.Keys.FirstOrDefault(p => p.Instance == instance);

            if (key != null)
            {
                lock (reinjectionMap)
                    reinjectionMap.Remove(key);
            }
        }
        public void Write(IComponentInfo info, XmlWriter writer)
        {
            var pos = (PositionComponentInfo)info;

            if (pos.PersistOffscreen)
            {
                writer.WriteStartElement("Position");
                writer.WriteAttributeString("persistoffscreen", pos.PersistOffscreen.ToString());
                writer.WriteEndElement();
            }
        }
Example #37
0
            public void Dispose()
            {
                Component = null;
                Instance  = null;
                Kernel    = null;

                referenceList.Clear();
                referredList.Clear();
                referredList  = null;
                referenceList = null;
            }
Example #38
0
        /// <summary>
        /// 在组件元数据注册后进行监听,如果符合代理条件的就在元数据的扩展属性里面添加一个"proxy"标记位
        /// </summary>
        /// <param name="info"></param>
        public override void OnMetadataRegistered(IComponentInfo info)
        {
            Aspect.CheckAndRegisterAspectByInterceptorAttribute(info.Implementation);

            if (HasMatch(info))
            {
                info.ExtendedProperties["proxy"] = true;
            }

            base.OnMetadataRegistered(info);
        }
 /// <inheritdoc/>
 public virtual void Init(IActivator activator, IKernel kernel, IComponentInfo info, Action<IComponentInfo, object> onDestroying, Action<IComponentContext> onFetch)
 {
     Guard.NotNull(activator, "activator");
     Guard.NotNull(kernel, "kernel");
     Guard.NotNull(info, "info");
     this.Activator = activator;
     this.Kernel = kernel;
     this.Info = info;
     OnDestroying = onDestroying;
     OnFetch = onFetch;
 }
        public void Write(IComponentInfo info, XmlWriter writer)
        {
            var pos = (PositionComponentInfo)info;

            if (pos.PersistOffscreen)
            {
                writer.WriteStartElement("Position");
                writer.WriteAttributeString("persistoffscreen", pos.PersistOffscreen.ToString());
                writer.WriteEndElement();
            }
        }
Example #41
0
        internal void WritePart(IComponentInfo info, XmlWriter writer)
        {
            if (!ComponentWriters.ContainsKey(info.GetType()))
            {
                throw new Exception("No xml writer for component type: " + info.GetType().Name);
            }

            var compWriter = ComponentWriters[info.GetType()];

            compWriter.Write(info, writer);
        }
Example #42
0
        public static ConstructorInjection InspectConstructor(IComponentInfo ctx, IKernel kernel, ConstructorInfo ctor)
        {
            var item = new ConstructorInjection(ctor.GetParameters().Select(p => AttributeProviderInspector.InspectParameter(ctx, kernel, p)).ToArray())
            {
                Member            = ctor,
                Creator           = ctor.GetCreator(),
                IsMarkedInjection = ctor.HasAttribute <InjectAttribute>(false),
            };

            return(item);
        }
Example #43
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="info"></param>
 /// <param name="instance"></param>
 public override void OnPreDestroy(IComponentInfo info, object instance)
 {
     if (info.ExtendedProperties.ContainsKey("MembersRegistered"))
     {
         var exports = info.ExtendedProperties["MembersRegistered"] as IExportInfo[];
         foreach (var item in exports)
         {
             ServiceRegistry.Current.UnRegister(item.Id);
         }
     }
 }
 /// <summary>
 ///
 /// </summary>
 /// <param name="activator"></param>
 /// <param name="kernel"></param>
 /// <param name="info"></param>
 /// <param name="onFetch"></param>
 /// <param name="onDestroyed"></param>
 public virtual void Init(IActivator activator, IKernel kernel, IComponentInfo info, Action <IComponentInfo, object> onDestroyed, Action <IComponentContext> onFetch)
 {
     Guard.NotNull(activator, "activator");
     Guard.NotNull(kernel, "kernel");
     Guard.NotNull(info, "info");
     this.Activator = activator;
     this.Kernel    = kernel;
     this.Info      = info;
     OnDestroying   = onDestroyed;
     OnFetch        = onFetch;
 }
Example #45
0
 public override void OnPreDestroy(IComponentInfo info, object instance)
 {
     if (info.Implementation != null)
     {
         Console.WriteLine("OnPreDestroy:" + info.Implementation.Name);
     }
     else
     {
         Console.WriteLine("OnPreDestroy:" + info.Id);
     }
 }
Example #46
0
 public ComponentRegistration(IComponentInfo info, ILifestyleManager lifestyleManager)
 {
     Component        = info;
     LifestyleManager = lifestyleManager;
     if (!info.IsGenericType())
     {
         ComponentContext = new ComponentContext(lifestyleManager.Kernel, null)
         {
             LifestyleManager = lifestyleManager, Component = info
         };
     }
 }
Example #47
0
        private IActivator CreateActivator(IComponentInfo info)
        {
            var activator = ActivatorRegistry.Create(info.Activator);

            var delegateActivator = activator as DelegateActivator;

            if (delegateActivator != null)
            {
                delegateActivator.Creator = (ctx) => info.Factory();
            }
            return(activator);
        }
Example #48
0
        private ILifestyleManager CreateLifestyleManager(IComponentInfo info, IActivator activator)
        {
            var lifestyleMgr = LifestyleManagerRegistry.Create(info.Lifestyle);

            if (info.ExtendedProperties.ContainsKey("proxy"))
            {
                lifestyleMgr = new ProxyLifestyleManager(lifestyleMgr);
            }

            lifestyleMgr.Init(activator, this, info, Listner.OnPreDestroy, Listner.OnFetch);
            return(lifestyleMgr);
        }
        public void Write(IComponentInfo info, XmlWriter writer)
        {
            var coll = (CollisionComponentInfo)info;

            writer.WriteStartElement("Collision");
            writer.WriteAttributeString("Enabled", coll.Enabled.ToString());

            foreach (var box in coll.HitBoxes)
                WriteHitbox(box, writer);

            writer.WriteEndElement();
        }
Example #50
0
        private void ResolveConstructorInjection(IComponentInfo info, Type componentType)
        {
            var key = componentType.FullName + ":ctorInjections";

            info.ExtendedProperties[key] = componentType
                .GetConstructors()
                .Where(p => !ignoreVisitor.VisitConstructor(p))
                .Select(p => AttributeProviderInspector.InspectConstructor(info, Kernel, p))
                .OrderBy(p => p.IsMarkedInjection)
                .OrderByDescending(p => p.Dependencies.Length)
                .ToArray();

        }
Example #51
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="info"></param>
        public override void OnMetadataRegistered(IComponentInfo info)
        {
            var componentType = info.Implementation;
            DependencyManager.Refresh(info, Kernel);
        
            if (!info.IsGenericType())
            {

                if (info.Activator == ActivatorType.Default)
                    ResolveConstructorInjection(info, componentType);
                if (componentType != null)
                    ResolveInjectionInfo(info, componentType, componentType.FullName + ":InjectionInfos");
            }

            reinjectionManager.Reinjection(info.Implementation, Kernel);
        }
        public void Write(IComponentInfo info, XmlWriter writer)
        {
            var health = (HealthComponentInfo)info;

            writer.WriteStartElement("Health");
            writer.WriteAttributeString("max", health.Max.ToString());

            if (health.StartValue != null)
                writer.WriteAttributeString("startValue", health.StartValue.ToString());

            writer.WriteAttributeString("flash", health.FlashFrames.ToString());

            if (health.Meter != null)
                _meterWriter.Write(health.Meter, writer);

            writer.WriteEndElement();
        }
         /// <inheritdoc/>
         public override void OnMetadataRegistered(IComponentInfo info)
         {
             if (LastService == info && serviceDescriptors != null && serviceDescriptors.Length > 0)
             {
                 LastService = null;

                 
                 var registration = (Kernel as Kernel) .IdStores[info.Id];
                 
                 foreach (var item in serviceDescriptors)
                 {
                     if (!Kernel.HasRegister(item.Id))
                     {
                       
                        
                         kernel.IdStores[item.Id] = registration;
                             
                     }
                 }
             }
         }
Example #54
0
        public IObjectBuildContext Build(IComponentInfo info)
        {
            IObjectBuildContext ctx = new ObjectBuildContext(info, _k);

            _log.Debug("Build [PreCreation] policies.");
            BuildUpSteps(ctx, Stages.PreCreation);
            _log.Debug("Build [Creation] policies.");
            BuildUpSteps(ctx, Stages.Creation);
            _log.Debug("Build [Initialization] policies.");
            BuildUpSteps(ctx, Stages.Initialization);
            _log.Debug("Build [PostInitialization] policies.");
            BuildUpSteps(ctx, Stages.PostInitialization);

            //Note:Notify all policy(let precreation policy have chance to know instance created).
            _log.Debug("Notify policies build complete.");
            foreach (IPolicy policy in info.BuildPolicies)
                policy.OnBuildComplete(ctx);

            _log.Debug("Build completed.");
            return ctx;
        }
Example #55
0
        public void AddComponentInfo(IComponentInfo info)
        {
            if (_idInfoDict.ContainsKey(info.Id))
            {
                ExceptionHelper.ThrowDuplicateComponentId(info.Id);
            }
            else
            {
                _idInfoDict[info.Id] = info;
            }

            if (info.ServiceType == null)
                return;
            if (_serviceIdDict.ContainsKey(info.ServiceType))
            {
                _serviceIdDict[info.ServiceType] = string.Empty;
            }
            else
            {
                _serviceIdDict[info.ServiceType] = info.Id;
            }
        }
         public override bool OnMetadataRegistering(IComponentInfo info)
         {
             
             Type t = null;
             if (info.ExtendedProperties.ContainsKey("instance"))
             {
                 t = info.ExtendedProperties["instance"].GetType();
             }

             else
             {
                 t = info.Implementation;
             }

             if (t != null)
             {
                 serviceDescriptors = ServiceDescriptorManager.Register(t);
                 LastService = info;
             }

             return true;
         }
 public void Write(IComponentInfo info, XmlWriter writer)
 {
     writer.WriteElementString("Input", "");
 }
Example #58
0
 public virtual void Refresh(IComponentInfo info, IKernel kernel) { }
Example #59
0
 public InstanceWrapper(IKernel kernel, IComponentInfo component, object instance)
 {
     Kernel = kernel;
     Component = component;
     Instance = instance;
 }
Example #60
0
            public void Dispose()
            {
                Component = null;
                Instance = null;
                Kernel = null;

                referenceList.Clear();
                referredList.Clear();
                referredList = null;
                referenceList = null;
            }