コード例 #1
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            RegisterDependencies.Register(services);

            services.AddSwaggerGen(c =>
            {
                c.SwaggerDoc("v1", new Info {
                    Title = "TrabalhoIHM.Api", Version = "v1.1"
                });
            });

            services.AddDbContext <EscolaContext>(options =>
                                                  options.UseSqlServer(Configuration.GetConnectionString("Escola")));

            services.AddCors(options =>
            {
                options.AddPolicy("AllowAll", p =>
                {
                    p.AllowAnyOrigin()
                    .AllowAnyHeader()
                    .AllowAnyMethod();
                });
            });

            services.AddMvc();
        }
コード例 #2
0
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddSwaggerGen(s =>
            {
                s.SwaggerDoc("v1", new Info
                {
                    Version     = "v1",
                    Title       = "Task List API",
                    Description = "API do projeto Task List"
                });
            });

            services.AddWebApi();


            ConfigContextAccessor(services);


            RegisterDependencies.Register(services, Configuration);
        }
コード例 #3
0
 static void Main(string[] args)
 {
     RegisterDependencies.Register();
 }