private StartIt(dynamic settings) { _settings = settings; var type = settings.GetType() as Type; AppAssemblies.Add(type.Assembly()); }
void Build() { var set = _settings as StartupContext; if (set != null) { set.AppAssemblies = AppAssemblies.ToArray(); } ConfigureLog(); RunTasks(); _logger = null; set?.Finished(); }
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); }
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(); }); }
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>(); } }); }
/// <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); }