2017-10-19 21 views

答えて

0

DotNet MVC Core 2.0では、toolingによって実行されるべきではないコードをprogram.cs mainに入れることが、ツールウェイで実行される唯一のコードであることが判明しました。

public static void Main(string[] args) 
    { 
     var host = BuildWebHost(args); 

     // Code placed here will not be executed by EF tooling as it calls BuildWebHost directly 

     host.Run(); 
    } 

    public static IWebHost BuildWebHost(string[] args) => 
     WebHost.CreateDefaultBuilder(args) 
      .UseStartup<Startup>() 
      .Build(); 
関連する問題