Update Music Store to use new EF EnsureCreated method.

Also updating project.json to pin the new EF build.
This commit is contained in:
ajcvickers 2014-05-13 15:16:19 -07:00
parent aeb22eaba7
commit 86e02878ed
2 changed files with 7 additions and 11 deletions

View File

@ -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();
}
}
}

View File

@ -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",