-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Open
Description
When a new migration is added, EF currently scaffolds a .NET type with the name of the migration. This leads to a variety of issues around the name being problematic in C#:
- The type name happens to be the same as a .NET type. A very frequent case is when users do
dotnet ef migrations add DateTime
. - The C# compiler now raises warnings when a type name could conflict with a future keyword (i.e. all-lowercase name), see #35938.
Migration files already have their creation timestamp prefixed to the name, so that migrations are properly sorted on the filesystem. We can simply append the same timestamp to the type name inside: public class DateTime_20250512080000 {...}
.
NeurekaSoftware and stevendarby