예제 #1
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddControllersWithViews();

            services.AddSingleton <IDockerService>(s => new DockerService());

            services.AddSingleton(s => DbServiceFactory.CreateFromEnvironmentVariables(s.GetRequiredService <IConfiguration>()));
            services.AddSingleton(s => s.GetRequiredService <IDbService>().Stacks);
        }
예제 #2
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddSignalR();

            services
            .AddControllersWithViews(o =>
            {
                o.Filters.Add(new TimedRequestAttribute());
            })
            .AddJsonOptions(o => JsonHelper.UpdateSerialiserOptions(o.JsonSerializerOptions));

            ConfigureDocker(services);

            services.AddSingleton(s => DbServiceFactory.CreateFromEnvironmentVariables());
            services.AddSingleton(s => s.GetRequiredService <IDbService>().Servers);
            services.AddSingleton(s => s.GetRequiredService <IDbService>().Containers);

            services.AddSingleton <IServerService>(s => new ServerService(
                                                       s.GetRequiredService <IDbService>(),
                                                       s.GetRequiredService <ITriceratopsDockerClient>()
                                                       ));
        }