public void Start() { _activator.Activate(new IPackageInfo[0], _log); EventAggregator.SendMessage(new ServiceStarted { ActivatorTypeName = _activator.GetType().AssemblyQualifiedName }); Console.WriteLine("Started service " + _activator); }
/// <summary> /// /// </summary> /// <param name="context"></param> /// <returns></returns> public override object Create(NLite.Mini.Context.IComponentContext context) { var impType = context.Component.Implementation; //if (impType.IsOpenGenericType()) // impType = impType.MakeCloseGenericType(context.GenericParameters); var Kernel = context.Kernel; var proxyFactory = Kernel.Get <IProxyFactory>(); bool createProxy = proxyFactory != null; if (createProxy == false) { return(Real.Create(context)); } object instance = null; object[] args = null; if (proxyFactory.RequiresTargetInstance(Kernel, context.Component)) { instance = Real.Create(context); } else if (!typeof(DefaultActivator).IsAssignableFrom(Real.GetType())) { instance = Real.Create(context); } else { args = GetConstructurArgs(context); } try { instance = proxyFactory.Create(context, instance, args); } catch (Exception ex) { throw new ActivatorException("ComponentActivator: could not proxy " + impType.FullName, ex); } return(instance); }