LoginSignup
1
2

More than 5 years have passed since last update.

EntityFrameworkのMigrationをデバッガで止める方法

Last updated at Posted at 2018-05-06

概要

Update-Databaseの実行を、デバッガで止めたいときがあります。
その方法です。

やること

1. Update-Databaseで実行されるコードでDebugger.Launch()を実行します。
DbContextを継承したクラスのデフォルトコンストラクタあたりがいいと思います。

ApplicationDbContext.cs
        public ApplicationDbContext()
        {
            if (!System.Diagnostics.Debugger.IsAttached)
            {
                System.Diagnostics.Debugger.Launch();
            }
        }

2. パッケージマネージャーコンソールからUpdate-Databaseを実行して、表示されるダイアログからデバッガを選択します。

参考URL

1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2