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

            services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);

            string connectionString = Configuration.GetConnectionString("Default");

            services.AddDbContext <EntityContext>(options =>
                                                  options.UseMySQL(connectionString)
                                                  );

            NativeInjector.Registros(services);

            var configuracoesSwagger = new Microsoft.OpenApi.Models.OpenApiInfo {
                Title = "TodoAPI", Version = "v1"
            };

            services.AddSwaggerGen(c =>
            {
                c.SwaggerDoc("v1", configuracoesSwagger);
            });
        }