Skip to content
forked from stil/efmig

Missing GUI for Entity Framework Core migrations.

License

Notifications You must be signed in to change notification settings

swiatek86/efmig

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

efmig

This is a multi-platform GUI application that greatly speeds up development when using Entity Framework Core.

build

alt text

Why you should use it:

  • You'll no longer need to remember dotnet ef commands syntax for creating, removing and generating migration scripts.
  • Dependency on Microsoft.EntityFrameworkCore.Design can be dropped inside your project.
  • You can remove IDesignTimeDbContextFactory<TDbContext> implementations from your project.

Important: This tool does not apply migrations on your database. It's designed to be non-destructive and you're expected to generate migration script, review it and run it manually in database client of your choice.

Configuration

  1. Download binaries for your platform from Releases page and launch the efmig executable.
  2. Click [+] button to create a new configuration profile.
  3. Fill configuration values
    • Profile name: this is a label of your choice for configuration profile.
    • dotnet-ef version: See NuGet page for available versions. Enter version matching your project.
    • Microsoft.EntityFrameworkCore.Design version: See NuGet page for available versions.
    • Target framework version: See this reference table for available versions.
    • Migrations directory. Enter a path relative to location of C# project where DbContext exists. Default value is Migrations.
    • DbContext .csproj path: pick the path of C# project that holds your DbContext class.
    • DbContext fully qualified name: this is a full class name of DbContext, for example MyApp.MyDbContext.
    • DbContext configuration code: here you need to configure connection string for dotnet-ef to work. See explanation below.
  4. Save profile.

DbContext configuration code

optionsBuilder variable of type DbContextBuilder<TYourDbContext> is defined and you are expected to configure connection string using C# syntax.

Postgres example

var connectionString = "Host=myserver;Username=mylogin;Password=mypass;Database=mydatabase";
optionsBuilder.UseNpgsql(connectionString);

MySQL example

var connectionString = "server=localhost;user=myuser;password=mypassword;database=mydb;";
var serverVersion = ServerVersion.AutoDetect(connectionString);
optionsBuilder.UseMySql(connectionString, serverVersion);

Usage

You can invoke one of the following actions:

  • Create a new migration. Specify its name beforehand and click [+] button on the right.
  • List migrations. This action does nothing but lists already existing migrations.
  • Remove most recent migration. This action removes most recent migration from the code. Nothing will happen on the actual database.
  • Generate migration script. This action opens default text editor with SQL code of all migrations for you to review.

Other screenshots

Profile configuration

alt text

Migration script output

alt text

About

Missing GUI for Entity Framework Core migrations.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 95.7%
  • TypeScript 4.3%