Esempio n. 1
0
        //This method gets called by the runtime CIL. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, MeetingSchemaContext contextDb)
        {
            try
            {
                using (var serviceScope = app.ApplicationServices.GetRequiredService <IServiceScopeFactory>().CreateScope())
                {
                    serviceScope.ServiceProvider.GetService <MeetingSchemaContext>().Database.Migrate();
                }
            }
            catch
            {
                //Catch error here if scope configuration get error
            }

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.UseStaticFiles();
            // Add MVC to the request pipeline.
            app.UseCors(builder =>
                        builder.AllowAnyOrigin()
                        .AllowAnyHeader()
                        .AllowAnyMethod());

            app.UseExceptionHandler(
                builder =>
            {
                builder.Run(
                    async context =>
                {
                    context.Response.StatusCode = (int)HttpStatusCode.InternalServerError;
                    context.Response.Headers.Add("Access-Control-Allow-Origin", "*");

                    var error = context.Features.Get <IExceptionHandlerFeature>();
                    if (error != null)
                    {
                        //context.Response.AddApplicationError(error.Error.Message);
                        await context.Response.WriteAsync(error.Error.Message).ConfigureAwait(false);
                    }
                });
            });

            //app.UseMvc();
            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}/{id?}");

                // Uncomment the following line to add a route for porting Web API 2 controllers.
                //routes.MapWebApiRoute("DefaultApi", "api/{controller}/{id?}");
            });


            /*Initialize the MeetingSchema database using EF
             * Comment out when you populate the database first time
             */
            //MeetingSchemaDbInitializer.Initialize(contextDb);
        }
Esempio n. 2
0
 public EntityBaseRepository(MeetingSchemaContext context)
 {
     _context = context;
 }
Esempio n. 3
0
 public ParticipantsReopsitory(MeetingSchemaContext contex) : base(contex)
 {
 }
 public MeetingSchemasRepository(MeetingSchemaContext contex) : base(contex)
 {
 }