You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Use the `--no-onconfiguring` (.NET CLI) or `-NoOnConfiguring` (Visual Studio Package Manager Console) argument when scaffolding from an existing database.
575
576
-[Customize the T4 templates](xref:core/managing-schemas/scaffolding/templates) to add back the call to `IsConfigured`.
In EF Core 6.0, calling `.ToTable((string)null, t => t.ExcludeFromMigrations())` was a valid way to configure a keyless entity type that is not mapped to a table and excluded from migrations. For example:
Starting with EF Core 7.0, calling `.ToTable((string)null, ...)` with the `Action<TableBuilder>` overload throws a `System.ArgumentNullException` because the `name` parameter is no longer nullable.
595
+
596
+
#### Why
597
+
598
+
This is a side effect of the changes made to support [table facets configuration](https://github.com/dotnet/efcore/issues/19811), which restructured the `ToTable` overloads.
599
+
600
+
#### Mitigations
601
+
602
+
Split the two calls. First, configure the table facets using the table builder overload (without specifying a null name), and then unmap the entity type from the table:
> Calling `.ToTable(t => t.ExcludeFromMigrations())` will map the entity type to its default table, so migrations will ignore it. However, querying the entity type will try to query the default table unless you also configure it with `ToView` or another mapping override. Calling `.ToTable((string?)null)` afterward unmaps it from the table.
0 commit comments