public void ConfigureServices(IServiceCollection services)
        {
            // get the connection string
            var connectionString = Configuration.GetConnectionString("DefaultConnection");

            // register DB CONTEXT (DataAccess dependencies)
            DiModule.Register(services, connectionString);

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

            //SWAGER:
            services.AddSwaggerDocument(config =>
            {
                config.PostProcess = document =>
                {
                    document.Info.Version     = "V1";
                    document.Info.Title       = "Homework-WebAPI: ToDo App";
                    document.Info.Description = "My First WebAPI App";
                    document.Info.Contact     = new NSwag.OpenApiContact
                    {
                        Name  = "Dushko Videski",
                        Email = "*****@*****.**"
                    };
                };
            });
        }
Beispiel #2
0
        public void ConfigureServices(IServiceCollection services)
        {
            // CORS
            services.AddCors(opt =>
            {
                opt.AddPolicy("CorsPolicy", builder => builder.AllowAnyOrigin()
                              .AllowAnyMethod()
                              .AllowAnyHeader()
                              .AllowCredentials());
            });

            // get the connection string
            var connectionString = Configuration.GetConnectionString("DefaultConnection");

            // DB CONTEXT and REPOSITORIES registration
            DiModule.Register(services, connectionString);


            // SERVICES registration
            services.AddTransient <IStudentService, StudentService>();


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

            //SWAGER:
            services.AddSwaggerDocument(config =>
            {
                config.PostProcess = document =>
                {
                    document.Info.Version     = "V1";
                    document.Info.Title       = "Polar Cape test assignment";
                    document.Info.Description = "Simplified Collage System App";
                    document.Info.Contact     = new NSwag.OpenApiContact
                    {
                        Name  = "Dushko Videski",
                        Email = "*****@*****.**"
                    };
                };
            });
        }