efcore
efcore copied to clipboard
Be more forgiving on DbContext name for migrations
I recently started working with a project that has two DbContext in it. Thus I am typing more -context EmployeeDbContext
. In other projects the team uses `EmployeeContext'. I'd like to cut down on the number of characters I have to type to match to a context.
I see the code already does a case insensitive to find a .Single and if not, it further tries to restrict down to a .Single by using exact case. I'd like to add a first pass case where Context
and DbContext
are added as a suffix to the name. So this would work
add-migration NameOfMigration -context employee
The normal duplicate error message would show if both EmployeeContext
and EmployeeDbContext
existed.
We can consider wildcards here, e.g. -context Employee*
. For example, dotnet test --filter
allows wildcards for selecting which tests to run.
Note from triage: The PMC commands already support tab-completion, and #5976 covers adding this for the dotnet CLI. We feel this is a better way to go that wildcards, since only one DbContext type can be specified at a time.