public static IRhetosHostBuilder CreateRhetosHostBuilder()
        {
            var host          = CreateHostBuilder(null).Build();
            var configuration = host.Services.GetRequiredService <IConfiguration>();

            var rhetosHostBuilder = new RhetosHostBuilder();

            Startup.ConfigureRhetosHostBuilder(rhetosHostBuilder, configuration);

            return(rhetosHostBuilder);
        }
Example #2
0
        public static RhetosAspNetServiceCollectionBuilder AddRhetos(this IServiceCollection serviceCollection, Action <IRhetosHostBuilder> configureRhetosHost = null)
        {
            var rhetosHostBuilder = new RhetosHostBuilder();

            configureRhetosHost?.Invoke(rhetosHostBuilder);
            var rhetosHost = rhetosHostBuilder.Build();

            serviceCollection.AddSingleton(rhetosHost);
            serviceCollection.AddScoped <RhetosScopeServiceProvider>();
            serviceCollection.AddScoped(typeof(IRhetosComponent <>), typeof(RhetosComponent <>));

            return(new RhetosAspNetServiceCollectionBuilder(serviceCollection, rhetosHost));
        }
        // This method exposes IRhetosHostBuilder for purposes of tooling using same configuration values
        // and same RhetosHostBuilder configuration delegate as the app itself
        public static IRhetosHostBuilder CreateRhetosHostBuilder()
        {
            // create Host for this web app
            var host = CreateHostBuilder(null).Build();

            // extract configuration of the web app
            var configuration = host.Services.GetRequiredService <IConfiguration>();

            // Create RhetosHostBuilder and configure it
            var rhetosHostBuilder = new RhetosHostBuilder();

            Startup.ConfigureRhetosHostBuilder(rhetosHostBuilder, configuration);

            return(rhetosHostBuilder);
        }
        // Method by convention. Any Rhetos tooling (e.g. dbupdate) will look for this method in current application
        // to create host for all its operations.
        public static IRhetosHostBuilder CreateRhetosHostBuilder()
        {
            var configuration = new Microsoft.Extensions.Configuration.ConfigurationBuilder()
                                .AddJsonFile("console-app-settings.json")
                                .AddJsonFile("console-app-settings.local.json")
                                .Build();

            var rhetosHostBuilder = new RhetosHostBuilder()
                                    .ConfigureRhetosHostDefaults()
                                    .ConfigureConfiguration(builder => builder.MapNetCoreConfiguration(configuration))
                                    .ConfigureContainer(builder =>
            {
                builder.UseUserInfoProvider(() => new ProcessUserInfo());
            });

            return(rhetosHostBuilder);
        }