From f258b008fa33ad5e4147c905b1934212ad34da7e Mon Sep 17 00:00:00 2001 From: David Fowler Date: Thu, 17 Apr 2014 21:21:57 -0700 Subject: [PATCH] Fixed build break and used new pattern for using mvc --- src/MusicStore/Startup.cs | 37 +++++++++-------------- src/MvcMusicStore/Scripts/_references.js | Bin 682 -> 684 bytes 2 files changed, 15 insertions(+), 22 deletions(-) diff --git a/src/MusicStore/Startup.cs b/src/MusicStore/Startup.cs index 1c385c26db..d61ce83d3b 100644 --- a/src/MusicStore/Startup.cs +++ b/src/MusicStore/Startup.cs @@ -23,18 +23,15 @@ using System.IO; public class Startup { - private static void ConfigureServices(ServiceCollection services) - { - services.AddInstance(new NullLoggerFactory()); - services.AddMvc(); - - services.AddInstance>(new UserManager(new InMemoryUserStore())); - services.AddInstance>(new RoleManager(new InMemoryRoleStore())); - } - public void Configuration(IBuilder app) { - app.UseContainer(ConfigureServices); + app.UseServices(services => + { + services.AddInstance(new NullLoggerFactory()); + services.AddMvc(); + services.AddInstance>(new UserManager(new InMemoryUserStore())); + services.AddInstance>(new RoleManager(new InMemoryRoleStore())); + }); //ErrorPageOptions.ShowAll to be used only at development time. Not recommended for production. app.UseErrorPage(ErrorPageOptions.ShowAll); @@ -47,20 +44,16 @@ public class Startup LoginPath = new PathString("/Account/Login") }); - var routes = new RouteCollection() + app.UseMvc(routes => { - DefaultHandler = new MvcRouteHandler(), - }; + routes.MapRoute( + "{controller}/{action}", + new { controller = "Home", action = "Index" }); - routes.MapRoute( - "{controller}/{action}", - new { controller = "Home", action = "Index" }); - - routes.MapRoute( - "{controller}", - new { controller = "Home" }); - - app.UseRouter(routes); + routes.MapRoute( + "{controller}", + new { controller = "Home" }); + }); SampleData.InitializeMusicStoreDatabaseAsync().Wait(); CreateAdminUser(app.ServiceProvider); diff --git a/src/MvcMusicStore/Scripts/_references.js b/src/MvcMusicStore/Scripts/_references.js index cd77b8b186494a48617254e0bcef15bc7918f024..b1bac51ae244f3fbc80f91448a472f9a4d288a03 100644 GIT binary patch delta 44 zcmZ3*x`uT^-oz7rlN*?X*bNyB81xv7CckH#JNX`C6cCF{ZeR?Wm=`r!j8OpqS-1}H delta 41 wcmZ3(x{7r|-ee=DsEK)glY5vHCfhK2O@6=_H2DCd!sIqax5;vhAwVn#05v`hm;e9(