From ced7372fd2e42889fbf305eb8c5501fe5faa75ae Mon Sep 17 00:00:00 2001 From: Jess Chadwick Date: Sat, 29 Aug 2015 22:42:41 -0400 Subject: [PATCH] Upgrading to beta6 --- AspNetBlog/global.json | 4 ++-- .../Controllers/AccountController.cs | 4 ++-- .../src/AspNetBlog/Models/BlogDataContext.cs | 7 ------ AspNetBlog/src/AspNetBlog/Startup.cs | 14 +++++++----- AspNetBlog/src/AspNetBlog/project.json | 22 +++++++++---------- .../src/AspNetBlog/wwwroot/lib/.gitignore | 1 - README.md | 20 +++++++++++++++++ 7 files changed, 43 insertions(+), 29 deletions(-) delete mode 100644 AspNetBlog/src/AspNetBlog/wwwroot/lib/.gitignore diff --git a/AspNetBlog/global.json b/AspNetBlog/global.json index e4370fd..84b0e87 100644 --- a/AspNetBlog/global.json +++ b/AspNetBlog/global.json @@ -1,6 +1,6 @@ -{ +{ "projects": [ "src", "test" ], "sdk": { - "version": "1.0.0-beta4" + "version": "1.0.0-beta6" } } diff --git a/AspNetBlog/src/AspNetBlog/Controllers/AccountController.cs b/AspNetBlog/src/AspNetBlog/Controllers/AccountController.cs index 273d6ed..ff2ef8e 100644 --- a/AspNetBlog/src/AspNetBlog/Controllers/AccountController.cs +++ b/AspNetBlog/src/AspNetBlog/Controllers/AccountController.cs @@ -53,9 +53,9 @@ public async Task Login(LoginViewModel login, string returnUrl = } [HttpPost] - public IActionResult Logout(string returnUrl = null) + public async Task Logout(string returnUrl = null) { - _signInManager.SignOut(); + await _signInManager.SignOutAsync(); if (string.IsNullOrWhiteSpace(returnUrl)) return RedirectToAction("Index", "Home"); diff --git a/AspNetBlog/src/AspNetBlog/Models/BlogDataContext.cs b/AspNetBlog/src/AspNetBlog/Models/BlogDataContext.cs index a127946..5d80ac9 100644 --- a/AspNetBlog/src/AspNetBlog/Models/BlogDataContext.cs +++ b/AspNetBlog/src/AspNetBlog/Models/BlogDataContext.cs @@ -28,12 +28,5 @@ public IQueryable GetArchivedPosts() Month = group.Key.Month, }); } - - protected override void OnModelCreating(ModelBuilder modelBuilder) - { - base.OnModelCreating(modelBuilder); - - modelBuilder.ForSqlServer().UseIdentity(); - } } } diff --git a/AspNetBlog/src/AspNetBlog/Startup.cs b/AspNetBlog/src/AspNetBlog/Startup.cs index 581a16f..1b68b50 100644 --- a/AspNetBlog/src/AspNetBlog/Startup.cs +++ b/AspNetBlog/src/AspNetBlog/Startup.cs @@ -5,9 +5,10 @@ using Microsoft.AspNet.Builder; using Microsoft.AspNet.Http; using Microsoft.Framework.DependencyInjection; -using Microsoft.Framework.ConfigurationModel; +using Microsoft.Framework.Configuration; using Microsoft.Data.Entity; using Microsoft.AspNet.Identity.EntityFramework; +using Microsoft.Framework.Runtime; namespace AspNetBlog { @@ -15,13 +16,14 @@ public class Startup { private IConfiguration config; - public Startup() + public Startup(IApplicationEnvironment env) { - config = new Configuration() + config = new ConfigurationBuilder(env.ApplicationBasePath) .AddEnvironmentVariables() .AddJsonFile("config.json") .AddJsonFile("config.dev.json", true) - .AddUserSecrets(); + .AddUserSecrets() + .Build(); } // For more information on how to configure your application, visit http://go.microsoft.com/fwlink/?LinkID=398940 @@ -50,7 +52,7 @@ public void Configure(IApplicationBuilder app) { var password = config.Get("password"); - if (config.Get("RecreateDatabase")) + if (config.Get("RecreateDatabase") == "true") { var context = app.ApplicationServices.GetService(); context.Database.EnsureDeleted(); @@ -60,7 +62,7 @@ public void Configure(IApplicationBuilder app) app.UseIdentity(); - if (config.Get("debug")) + if (config.Get("debug") == "true") { app.UseErrorPage(); app.UseRuntimeInfoPage(); diff --git a/AspNetBlog/src/AspNetBlog/project.json b/AspNetBlog/src/AspNetBlog/project.json index a41fc09..c300126 100644 --- a/AspNetBlog/src/AspNetBlog/project.json +++ b/AspNetBlog/src/AspNetBlog/project.json @@ -4,17 +4,17 @@ "version": "1.0.0-*", "dependencies": { - "Microsoft.AspNet.Server.IIS": "1.0.0-beta4", - "Microsoft.AspNet.Server.WebListener": "1.0.0-beta4", - "Microsoft.AspNet.StaticFiles": "1.0.0-beta4", - "Microsoft.AspNet.Mvc": "6.0.0-beta4", - "Microsoft.AspNet.Mvc.TagHelpers": "6.0.0-beta4", - "EntityFramework.SqlServer": "7.0.0-beta4", - "Microsoft.AspNet.Diagnostics": "1.0.0-beta4", - "Microsoft.Framework.ConfigurationModel": "1.0.0-beta4", - "Microsoft.Framework.ConfigurationModel.UserSecrets": "1.0.0-beta4", - "Microsoft.Framework.ConfigurationModel.Json": "1.0.0-beta4", - "Microsoft.AspNet.Identity.EntityFramework": "3.0.0-beta4" + "Microsoft.AspNet.Server.IIS": "1.0.0-beta6", + "Microsoft.AspNet.Server.WebListener": "1.0.0-beta6", + "Microsoft.AspNet.StaticFiles": "1.0.0-beta6", + "Microsoft.AspNet.Mvc": "6.0.0-beta6", + "Microsoft.AspNet.Mvc.TagHelpers": "6.0.0-beta6", + "EntityFramework.SqlServer": "7.0.0-beta6", + "Microsoft.AspNet.Diagnostics": "1.0.0-beta6", + "Microsoft.Framework.Configuration": "1.0.0-beta6", + "Microsoft.Framework.Configuration.UserSecrets": "1.0.0-beta6", + "Microsoft.Framework.Configuration.Json": "1.0.0-beta6", + "Microsoft.AspNet.Identity.EntityFramework": "3.0.0-beta6" }, "commands": { diff --git a/AspNetBlog/src/AspNetBlog/wwwroot/lib/.gitignore b/AspNetBlog/src/AspNetBlog/wwwroot/lib/.gitignore deleted file mode 100644 index 47ad1b1..0000000 --- a/AspNetBlog/src/AspNetBlog/wwwroot/lib/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*.* \ No newline at end of file diff --git a/README.md b/README.md index b79fb9b..3a3a5c9 100644 --- a/README.md +++ b/README.md @@ -8,3 +8,23 @@ Demo source code and links for Lynda.com Up and Running with ASP.NET 5 training ## Exercise File versions * __1.0.0-beta4__ *(what is shown in the videos)*__:__ [Sample application code](https://github.com/jchadwick/UpAndRunningWithAspNet5/tree/beta4/AspNetBlog) +* __1.0.0-beta6__: [Sample application code](https://github.com/jchadwick/UpAndRunningWithAspNet5/tree/beta6/AspNetBlog) + +## Release Notes + +### beta4 to beta6 [(Full file comparison)](https://github.com/jchadwick/UpAndRunningWithAspNet5/compare/beta4...beta6) + +__Namespace/Library changes__ +* `Microsoft.Framework.ConfigurationModel` renamed to `Microsoft.Framework.Configuration` + +__API changes__ +* __Configuration__ + * *[Startup.cs: line 21]* Must use `ConfigurationBuilder` instead of `Configuration` to create configuration objects + * *[Startup.cs: line 21]* New `ConfigurationBuilder` requires base path for configuration files; inject `IApplicationEnvironment` into the `Startup` constructor *[Startup.cs: line 19]* and call `IApplicationEnvironment.ApplicationBasePath` + * *[Startup.cs: line 26]* Must call `.Build()` after adding configuration sources to generate configuration object + * *[Startup.cs: lines 55, 65]* `IConfiguration.Get()` no longer offered - must use non-generic version, which returns a string +* __Entity Framework__ + * *[BlogDataContext.cs: line 36]* `ModelBuilder.ForSqlServer()` extension no longer provided/required - removed entire extraneous section +* __Identity__ + * *[AccountController.cs: line 58]* Synchronous version of `SignInManager.SignOut()` no longer offered - must use `.SignOutAync()`. + *Also converted the controller action to an async action, though this is not required* \ No newline at end of file