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.AddEntityFrameworkSqlServer()
            .AddDbContext <BaseContexto>(
                options => options.UseSqlServer(
                    Configuration.GetConnectionString("BaseDatabase")));

            InjectorDependencies.Registrer(services);
            services.AddAutoMapper(x => x.AddProfile(new BaseMapping()));
            services.AddMvc();

            services.AddSwaggerGen(c =>
            {
                c.SwaggerDoc("v1", new OpenApiInfo
                {
                    Version     = "v1",
                    Title       = "API",
                    Description = "",
                    Contact     = new OpenApiContact
                    {
                        Name  = "Igor Andrade",
                        Email = string.Empty
                    }
                });
            });
        }
Esempio n. 2
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddEntityFrameworkSqlServer()
            .AddDbContext <BaseContexto>(
                options => options.UseSqlServer(
                    Configuration.GetConnectionString("BaseDatabase")));

            InjectorDependencies.Registrer(services);
            services.AddAutoMapper(x => x.AddProfile(new BaseMapping()));
            services.AddMvc();
            services.AddControllers().AddNewtonsoftJson();

            ConfigureAuth(services);
            ConfigureSwagger(services);
        }