Permalink
Browse files

Merge pull request #1785 from NuGet/anurse/dbcontextinitializer

Move Database Initializer code to EntitiesContext
  • Loading branch information...
2 parents eef9a38 + b013432 commit cb611743950d94057809ea553c2cbddcb7cc2231 @anurse anurse committed Jan 29, 2014
Showing with 6 additions and 7 deletions.
  1. +6 −0 src/NuGetGallery.Core/Entities/EntitiesContext.cs
  2. +0 −7 src/NuGetGallery/App_Start/AppActivator.cs
@@ -7,6 +7,12 @@ namespace NuGetGallery
{
public class EntitiesContext : DbContext, IEntitiesContext
{
+ static EntitiesContext()
+ {
+ // Don't run migrations, ever!
+ Database.SetInitializer<EntitiesContext>(null);
+ }
+
/// <summary>
/// The NuGet Gallery code should usually use this constructor, in order to respect read only mode.
/// </summary>
@@ -62,7 +62,6 @@ public static void PostStart()
{
// Get configuration from the kernel
var config = Container.Kernel.Get<IAppConfiguration>();
- DbMigratorPostStart();
BackgroundJobsPostStart(config);
AppPostStart();
BundlingPostStart();
@@ -214,12 +213,6 @@ private static void BackgroundJobsStop()
_jobManager.Dispose();
}
- private static void DbMigratorPostStart()
- {
- // Don't run migrations, ever!
- Database.SetInitializer<EntitiesContext>(null);
- }
-
private static void NinjectPreStart()
{
DynamicModuleUtility.RegisterModule(typeof(OnePerRequestHttpModule));

0 comments on commit cb61174

Please sign in to comment.