// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }


            app.UseExceptionHandler("/api/Error/HandlingException");

            app.UseStaticFiles();
            app.UseAuthentication();

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

            // Check if Starup is invoked by entityFramework and if so we can't continue because of infinite loop in Observer
            StackTrace    stackTrace = new StackTrace();
            List <string> efMethods  = new List <string>()
            {
                "RemoveMigration", "AddMigration", "UpdateDatabase"
            };

            if (stackTrace.GetFrames().Any(f => efMethods.Contains(f.GetMethod().Name)))
            {
                return;
            }

            RabbitMessenger.Setup(Configuration, env);
            EmailManager.Setup(Configuration);
        }
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, IConfiguration configuration, DBEntities dBEntities)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.UseMvc();

            // Check if Starup is invoked by entityFramework and if so we can't continue because of infinite loop in Observer
            StackTrace    stackTrace = new StackTrace();
            List <string> efMethods  = new List <string>()
            {
                "RemoveMigration", "AddMigration", "UpdateDatabase"
            };

            if (stackTrace.GetFrames().Any(f => efMethods.Contains(f.GetMethod().Name)))
            {
                return;
            }

            RabbitMessenger.Setup(configuration, env);
            Observer.Setup(configuration);
        }