public override void Before(MethodInfo methodUnderTest) { Database.Delete("DataContext"); var configuration = new MigrationConfiguration(); var migrator = new DbSeederMigrator<DataContext>(configuration); migrator.MigrateToLatestVersion(); }
public override void Before(MethodInfo methodUnderTest) { Database.Delete("DataContext"); var configuration = new MigrationConfiguration(); var migrator = new DbSeederMigrator <DataContext>(configuration); migrator.MigrateToLatestVersion(); }
public KernelEventCompletedArguments Execute() { // Hhack to disable migrating when visual studio creates migrations. // This is due to the fact that EntityFramework uses some static information and this // application loads everyting upfront if (!System.AppDomain.CurrentDomain.SetupInformation.AppDomainManagerAssembly.Contains( "Microsoft.VisualStudio.Platform.AppDomainManager")) { var configuration = new MigrationConfiguration(); var migrator = new DbSeederMigrator <DataContext>(configuration); try { migrator.MigrateToLatestVersion(); } catch (System.Exception ex) { return(new KernelEventCompletedArguments { AllowContinue = false, KernelEventSucceeded = false, Issues = new IError[] { new GenericError { ErrorMessage = "Could not migrate to latest version.", ErrorException = ex, Severity = ErrorSeverity.Critical } } }); } } return(new KernelEventCompletedArguments() { AllowContinue = true, KernelEventSucceeded = true, Issues = null }); }
public KernelEventCompletedArguments Execute() { // Hhack to disable migrating when visual studio creates migrations. // This is due to the fact that EntityFramework uses some static information and this // application loads everyting upfront if (!System.AppDomain.CurrentDomain.SetupInformation.AppDomainManagerAssembly.Contains( "Microsoft.VisualStudio.Platform.AppDomainManager")) { var configuration = new MigrationConfiguration(); var migrator = new DbSeederMigrator<DataContext>(configuration); try { migrator.MigrateToLatestVersion(); } catch (System.Exception ex) { return new KernelEventCompletedArguments { AllowContinue = false, KernelEventSucceeded = false, Issues = new IError[] { new GenericError { ErrorMessage = "Could not migrate to latest version.", ErrorException = ex, Severity = ErrorSeverity.Critical } } }; } } return new KernelEventCompletedArguments() { AllowContinue = true, KernelEventSucceeded = true, Issues = null }; }