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(options =>
            {
                options.AddPolicy("AllowAll",
                                  builder =>
                {
                    builder
                    .AllowAnyOrigin()
                    .AllowAnyMethod()
                    .AllowAnyHeader()
                    .AllowCredentials();
                });
            });
            services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
            services.AddCors();
            ServiceRegistration.ServiceRegistrator(services);


            // In production, the Angular files will be served from this directory
            services.AddSpaStaticFiles(configuration =>
            {
                configuration.RootPath = "ClientApp/dist";
            });
            var connection = @"Server=DESKTOP-UONO7AU\SQLEXPRESS;Database=MultimediaManagement;Trusted_Connection=True;ConnectRetryCount=0";

            services.AddDbContext <MultimediaManagementContext>(options => options.UseSqlServer(connection));
        }