DEV Community

MAHMOUD BU SALEH
MAHMOUD BU SALEH

Posted on

I Built EFX to Turn 4 EF Core Steps Into One Command

 I kept doing the same thing every time I added an entity to an EF Core project.

Create the class.

Add the DbSet.

Create the migration.

Update the database.

None of these steps is difficult. The annoying part is doing them again and again, especially when I'm prototyping and the database schema changes constantly.

So I built a small .NET global tool called EFX.

The idea is simple:

efx new Product
Enter fullscreen mode Exit fullscreen mode

Instead of manually going through the whole setup, EFX handles the repetitive parts for me.

It creates the entity:

public class Product
{
    public int Id { get; set; }
}
Enter fullscreen mode Exit fullscreen mode

Then it registers the DbSet in the DbContext:

public DbSet<Product> Products => Set<Product>();
Enter fullscreen mode Exit fullscreen mode

After that, it runs:

dotnet ef migrations add AddProduct
dotnet ef database update
Enter fullscreen mode Exit fullscreen mode

So the workflow becomes:

Create entity → Register DbSet → Create migration → Update database

with one command.

Why I built it

This isn't meant to replace EF Core or hide what's happening in the database.

It's just about removing repetitive boilerplate.

During early development, I can end up changing the schema several times in a short period. Having a tiny command that handles the mechanical steps makes that loop a little nicer.

Current status

EFX is still a small prototype, and that's exactly why I'm sharing it now.

I'd like feedback from people who actually use EF Core:

Would you use this?

What would you change?

What edge cases am I missing?

Project:
https://github.com/dotnet/efcore/issues/39569#issuecomment-6786874939

Top comments (0)