Esempio n. 1
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddControllers();

            //Setup para configuração do Swagger
            SwaggerConfiguration.AddSwagger(services);

            //Setup para configuração do EntityFramework
            EntityFrameworkConfiguration.AddEntityFramework(services, Configuration);

            //Setup para configuração do JWT
            JwtConfiguration.ConfigureServices(services, Configuration);

            //Setup para o MongoDB
            MongoDBConfiguration.AddMongoDBSetup(services, Configuration);

            //Injeção de dependência
            DependencyInjectionConfiguration.AddDependencyInjection(services);

            //Setup para o MediatR
            MediatRConfiguration.AddMediatRSetup(services);

            //Setup para o AutoMapper
            AutoMapperConfiguration.AddAutoMapperSetup(services);

            //Setup para o CORS
            CorsConfiguration.AddCors(services);
        }
Esempio n. 2
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public IServiceProvider ConfigureServices(IServiceCollection services)
        {
            // Enable CORS
            // Set it before of enable MVC
            services.AddCors();
            // Add framework services.
            services.AddMvc();
            // Setup options with DI
            services.AddOptions();
            // Setup Swagger
            services.AddSwaggerGen();
            SwaggerConfiguration.AddSwagger(services);
            // Configuration Properties
            services.Configure <MySqlDataSourcePropertyConfiguration>(Configuration.GetSection("DatabaseConfiguration"));

            // Create the container builder.
            var builder = new ContainerBuilder();

            RepositoryConfiguration.AddRepositories(builder);
            ServiceConfiguration.AddServices(builder);
            builder.Populate(services);
            this.ApplicationContainer = builder.Build();

            // Create the IServiceProvider based on the container.
            return(new AutofacServiceProvider(this.ApplicationContainer));
        }
Esempio n. 3
0
 // This method gets called by the runtime. Use this method to add services to the container.
 public void ConfigureServices(IServiceCollection services)
 {
     services.AddControllers();
     SwaggerConfiguration.AddSwagger(services);
     EntityFrameworkConfiguration.AddEntityFramework(services);
     JwtConfiguration.AddJwt(services, Configuration);
     DependencyInjectionConfiguration.AddDependencyInjection(services);
     AutoMapperConfiguration.AddAutoMapperSetup(services);
 }
Esempio n. 4
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
        {
            LoggingConfiguration.ConfigureLogging(app, env, loggerFactory, Configuration);
            app.UseAuthentication();
            SwaggerConfiguration.AddSwagger(app);
            CorsConfiguration.UseCors(app);
            if (!env.IsDevelopment())
            {
                var context = app.ApplicationServices.GetService <PgsKanbanContext>();
                context.Database.Migrate();
            }

            SignalRConfiguration.UseSignalR(app);
            app.UseMvc();
        }
        // This method gets called by the runtime. Use this method to add services to the container.
        // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddControllers();

            //configuração do swagger
            SwaggerConfiguration.AddSwagger(services);

            //configuração do EntityFramework
            EntityFrameworkConfiguration.AddPostgreSQLEntityFramework(services, Configuration);

            //configuração para autenticação por JWT
            JwtConfiguration.AddJwt(services, Configuration);

            //configuração para injeção de dependência
            DependencyInjectionConfiguration.AddDependencyInjection(services, Configuration);

            //configuração de CORS
            CorsConfiguration.AddCors(services);
        }
Esempio n. 6
0
 // This method gets called by the runtime. Use this method to add services to the container.
 public void ConfigureServices(IServiceCollection services)
 {
     services.AddControllers();
     SwaggerConfiguration.AddSwagger(services);
     DependencyInjectionConfiguration.AddDependencyInjection(services, Configuration);
 }