Esempio n. 1
0
        private StartIt(dynamic settings)
        {
            _settings = settings;
            var type = settings.GetType() as Type;

            AppAssemblies.Add(type.Assembly());
        }
Esempio n. 2
0
        void Build()
        {
            var set = _settings as StartupContext;

            if (set != null)
            {
                set.AppAssemblies = AppAssemblies.ToArray();
            }
            ConfigureLog();
            RunTasks();
            _logger = null;

            set?.Finished();
        }
Esempio n. 3
0
        public void Execute()
        {
            var types = new List <Type>();

            var projects = AppAssemblies.AsEnumerable().Where(x => x.FullName.StartsWith("GotNext."));

            foreach (var project in projects)
            {
                types.AddRange(project.GetExportedTypes().AsEnumerable());
            }

            LoadStandardMappings(types);
            LoadCustomMappings(types);
        }
Esempio n. 4
0
        public StandardRegistry()
        {
            var projects = AppAssemblies.AsEnumerable().Where(x => x != Assembly.GetExecutingAssembly() && x.FullName.StartsWith("GotNext."));

            this.Scan(scan =>
            {
                foreach (var project in projects)
                {
                    scan.Assembly(project);
                }

                scan.WithDefaultConventions();
                scan.LookForRegistries();
            });
        }
Esempio n. 5
0
        public TaskRegistry()
        {
            var projects = AppAssemblies.AsEnumerable().Where(x => x.FullName.StartsWith("GotNext."));

            this.Scan(
                scan =>
            {
                foreach (var project in projects)
                {
                    scan.Assembly(project);
                    scan.AddAllTypesOf <IRunAtInit>();
                    scan.AddAllTypesOf <IRunAtStartup>();
                    scan.AddAllTypesOf <IRunOnEachRequest>();
                    scan.AddAllTypesOf <IRunOnError>();
                    scan.AddAllTypesOf <IRunAfterEachRequest>();
                }
            });
        }
Esempio n. 6
0
        /// <summary>
        /// This searches and invokes the logging configuration class.
        /// Override if you want to configure logging directly
        /// </summary>
        private void ConfigureLog()
        {
            var logConfig = AppAssemblies.SelectMany(a => a.GetPublicTypes(t => t.Name == ConfigureLoggerName)).FirstOrDefault();

            if (logConfig == null)
            {
                return;
            }
            dynamic inst   = System.TypeExtensions.CreateInstance(logConfig);
            var     method = IntrospectionExtensions.GetTypeInfo(logConfig).GetMethod("Run");

            var hasResult = method.ReturnType == typeof(Action <string>);

            if (hasResult)
            {
                _logger = inst.Run(_settings);
                return;
            }
            inst.Run(_settings);
        }