public static IApp CreateApp()
        {
            var configService = new ConfigService(new FilesConfigProvider("./Config", "yaml"), new YamlConfigSerializer());

            if (configService.Get <AppConfig>().Modules.Count == 0)
            {
                configService.Get <AppConfig>().Modules.Add(ModuleConfigElement.Create <WebAppInitializerModule>());
            }

            var app = AppBrix.App.Create(configService);

            app.Start();
            return(app);
        }
Esempio n. 2
0
 /// <summary>
 /// Creates a default application with a specified configuration service.
 /// Registers the provided module type in the <see cref="AppConfig"/>.
 /// </summary>
 /// <typeparam name="T">Type of the <see cref="MainModuleBase"/> to be registered.</typeparam>
 /// <param name="configService">The configuration service.</param>
 /// <returns>The created app.</returns>
 public static IApp Create <T>(IConfigService configService) where T : MainModuleBase, new()
 {
     configService.Get <AppConfig>().Modules.Add(ModuleConfigElement.Create <T>());
     return(App.Create(configService));
 }