Ejemplo n.º 1
0
        public void ApplicationStarted(IDexterContainer container)
        {
            IScheduler scheduler = container.Resolve<IScheduler>();

            IJobListener[] jobListeners = container.ResolveAll<IJobListener>();

            foreach (IJobListener jobListener in jobListeners)
            {
                scheduler.ListenerManager.AddJobListener(jobListener);
            }

            scheduler.Start();
        }
Ejemplo n.º 2
0
        public void ApplicationStarted(IDexterContainer container)
        {
            IScheduler scheduler = container.Resolve <IScheduler>();

            IJobListener[] jobListeners = container.ResolveAll <IJobListener>();

            foreach (IJobListener jobListener in jobListeners)
            {
                scheduler.ListenerManager.AddJobListener(jobListener);
            }

            scheduler.Start();
        }
Ejemplo n.º 3
0
        /// <summary>
        ///     Starts up.
        /// </summary>
        public static void StartUp()
        {
            if (started)
            {
                return;
            }

            ReadOnlyCollection <Assembly> alpAssemblies = new ReadOnlyCollection <Assembly>(BuildManager.GetReferencedAssemblies().Cast <Assembly>().Where(x => x.FullName.StartsWith("Dexter")).ToList());

            Type containerType = null;

            foreach (Assembly a in alpAssemblies)
            {
                foreach (Type t in a.GetTypes())
                {
                    if (!t.IsInterface && !t.IsAbstract && typeof(IDexterContainerFactory).IsAssignableFrom(t))
                    {
                        containerType = t;
                    }
                }
            }

            if (containerType == null)
            {
                throw new ArgumentException("Unable to find the DI Implementation.");
            }

            IDexterContainerFactory factory = Activator.CreateInstance(containerType) as IDexterContainerFactory;

            if (factory == null)
            {
                throw new ConfigurationErrorsException(string.Format("The type {0} does not implement the IDexterContainerFactory interface.", containerType.FullName));
            }

            Engine = factory.Create();
            Engine.Register(typeof(IDexterContainer), Engine, LifeCycle.Singleton);

            alpAssemblies.ForEach(x => Engine.Register <ILayerInstaller>(x, LifeCycle.Singleton));

            ILayerInstaller[] coreInstaller = Engine.ResolveAll <ILayerInstaller>();

            coreInstaller.ForEach(x => x.ServiceRegistration(Engine));
            coreInstaller.ForEach(x => x.ServiceRegistrationComplete(Engine));
            coreInstaller.ForEach(x => x.ApplicationStarted(Engine));

            started = true;
        }