Run database migrations using Entity Framework core on application start
<p>Is it possible to configure <code>StartUp.cs</code> or <code>project.json</code> to run database migrations using Entity Framework Core on application start?</p>

<p>Now I have middleware that do this task, but it seems to make negative influence on performance because database is being checked each request received.</p>

<pre><code>public class EntityFrameworkUpdateDatabaseMiddleware
{
    private readonly RequestDelegate _next;
    private readonly ApplicationDbContext _dbContext;

    public EntityFrameworkUpdateDatabaseMiddleware(RequestDelegate next, ApplicationDbContext dbContext)
    {
        _next = next;
        _dbContext = dbContext;
    }

    public async Task Invoke(HttpContext context)
    {
        await _dbContext.Database.MigrateAsync();
        await _next.Invoke(context);
    }
}
</code></pre>