From 86e02878edd590a4e22fd3699618376d3ab43bd4 Mon Sep 17 00:00:00 2001 From: ajcvickers Date: Tue, 13 May 2014 15:16:19 -0700 Subject: [PATCH] Update Music Store to use new EF EnsureCreated method. Also updating project.json to pin the new EF build. --- src/MusicStore/Models/SampleData.cs | 8 ++------ src/MusicStore/project.json | 10 +++++----- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/src/MusicStore/Models/SampleData.cs b/src/MusicStore/Models/SampleData.cs index 7cce58fd98..0882dc6e63 100644 --- a/src/MusicStore/Models/SampleData.cs +++ b/src/MusicStore/Models/SampleData.cs @@ -19,9 +19,8 @@ namespace MusicStore.Models var sqlServerDataStore = db.Configuration.DataStore as SqlServerDataStore; if (sqlServerDataStore != null) { - if (!await db.Database.ExistsAsync()) + if (await db.Database.EnsureCreatedAsync()) { - await db.Database.CreateAsync(); await InsertTestData(serviceProvider); } } @@ -39,10 +38,7 @@ namespace MusicStore.Models var sqlServerDataStore = db.Configuration.DataStore as SqlServerDataStore; if (sqlServerDataStore != null) { - if (!await db.Database.ExistsAsync()) - { - await db.Database.CreateAsync(); - } + await db.Database.EnsureCreatedAsync(); } } } diff --git a/src/MusicStore/project.json b/src/MusicStore/project.json index a9dfe2e697..8daea7a370 100644 --- a/src/MusicStore/project.json +++ b/src/MusicStore/project.json @@ -26,11 +26,11 @@ "Microsoft.AspNet.Security.DataProtection": "0.1-alpha-build-0150", "Microsoft.AspNet.Server.WebListener": "0.1-alpha-build-0469", "Microsoft.AspNet.StaticFiles": "0.1-alpha-build-0402", - "Microsoft.Data.Entity": "0.1-alpha-build-0766", - "Microsoft.Data.Entity.InMemory": "0.1-alpha-build-0766", - "Microsoft.Data.Entity.Migrations": "0.1-alpha-build-0766", - "Microsoft.Data.Entity.Relational": "0.1-alpha-build-0766", - "Microsoft.Data.Entity.SqlServer": "0.1-alpha-build-0766", + "Microsoft.Data.Entity": "0.1-alpha-build-0793", + "Microsoft.Data.Entity.InMemory": "0.1-alpha-build-0793", + "Microsoft.Data.Entity.Migrations": "0.1-alpha-build-0793", + "Microsoft.Data.Entity.Relational": "0.1-alpha-build-0793", + "Microsoft.Data.Entity.SqlServer": "0.1-alpha-build-0793", "Microsoft.Framework.ConfigurationModel": "0.1-alpha-build-0223", "Microsoft.Framework.ConfigurationModel.Json": "0.1-alpha-build-0223", "Microsoft.Framework.DependencyInjection": "0.1-alpha-build-0362",