Skip to content

Simplify Migrate() call to be as simple as EntityFrameworkCore #2053

Open
@jzabroski

Description

@jzabroski

Is your feature request related to a problem? Please describe.
EntityFrameworkCore's solution in a single page application has gotten very simple, and with the new .NET 10 #:package syntax, we really need to think about user experience to make FluentMigrator adoption more likely in the future, or we will fall behind ergonomically due to having a slightly steeper adoption curve. Simple wins.

Describe the solution you'd like
Here is an example taken from the CryptomonServer github open source project for how they configure EntityFrameworkCore code-first migrations:

using (var scope = app.Services.CreateScope())
{
    var db = scope.ServiceProvider.GetRequiredService<CryptomonDbContext>();
    db.Database.Migrate();
    db.Database.OpenConnection();
    // Npqsql provider caches type information, so need to reload it after migrations complete.
    ((NpgsqlConnection)db.Database.GetDbConnection()).ReloadTypes();
}

Additional context
https://github.com/MinaNavigator/CryptomonServer/blob/dec1b472bf1465d2038d2dc822f80c0a355d2cff/CryptomonServer/Program.cs#L68C1-L74C2

Is this a feature you'd like to submit a PR for?
Yes

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureA new feature (we all like those)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions