Fixing database changes from EF

This commit is contained in:
Suhas Joshi 2015-05-07 11:02:14 -07:00
parent 63038b7278
commit afca1242bc
2 changed files with 4 additions and 4 deletions

View File

@ -6,7 +6,7 @@ using System.Threading.Tasks;
using Microsoft.AspNet.Identity; using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Identity.EntityFramework; using Microsoft.AspNet.Identity.EntityFramework;
using Microsoft.Data.Entity; using Microsoft.Data.Entity;
using Microsoft.Data.Entity.SqlServer; using Microsoft.Data.Entity.Relational;
using Microsoft.Framework.DependencyInjection; using Microsoft.Framework.DependencyInjection;
using Microsoft.Framework.OptionsModel; using Microsoft.Framework.OptionsModel;
using MusicStore.Spa; using MusicStore.Spa;
@ -21,7 +21,7 @@ namespace MusicStore.Models
{ {
using (var db = serviceProvider.GetService<MusicStoreContext>()) using (var db = serviceProvider.GetService<MusicStoreContext>())
{ {
var sqlServerDatabase = db.Database as SqlServerDatabase; var sqlServerDatabase = db.Database as RelationalDatabase;
if (sqlServerDatabase != null) if (sqlServerDatabase != null)
{ {
if (await sqlServerDatabase.EnsureCreatedAsync()) if (await sqlServerDatabase.EnsureCreatedAsync())

View File

@ -5,7 +5,7 @@ using System.Security.Claims;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNet.Identity; using Microsoft.AspNet.Identity;
using Microsoft.Data.Entity; using Microsoft.Data.Entity;
using Microsoft.Data.Entity.SqlServer; using Microsoft.Data.Entity.Relational;
using Microsoft.Framework.ConfigurationModel; using Microsoft.Framework.ConfigurationModel;
using Microsoft.Framework.DependencyInjection; using Microsoft.Framework.DependencyInjection;
using Microsoft.Framework.Runtime; using Microsoft.Framework.Runtime;
@ -22,7 +22,7 @@ namespace MusicStore.Models
{ {
using (var db = serviceProvider.GetService<MusicStoreContext>()) using (var db = serviceProvider.GetService<MusicStoreContext>())
{ {
var sqlServerDatabase = db.Database as SqlServerDatabase; var sqlServerDatabase = db.Database as RelationalDatabase;
if (sqlServerDatabase != null) if (sqlServerDatabase != null)
{ {
if (await sqlServerDatabase.EnsureCreatedAsync()) if (await sqlServerDatabase.EnsureCreatedAsync())