private IApplicationInitializer[] GetInitializers() { try { var initializerTypes = _typeScanner.FindTypes <IApplicationInitializer>(ignoreInactiveModules: true); return(initializerTypes .Select(x => _scope.ResolveUnregistered(x) as IApplicationInitializer) .OrderBy(x => x.Order) .ToArray()); } catch (Exception ex) { _logger.Error(ex, "Error while resolving application initializers."); throw; } }
public static T ResolveUnregistered <T>(this IComponentContext scope) where T : class => (T)scope.ResolveUnregistered(typeof(T));