Closed Dreamoochy closed 2 years ago
The System.InvalidOperationException: Sequence contains no matching element
is fixed in ba0f2d61.
The reason why you don't see file for EmployeeTerritories
is because it's a M:N table and EF Core hides that relational detail from you (although you can change the mapping and use such entity). You can see the hidden entity here:
entity.HasMany(d => d.Territories)
.WithMany(p => p.Employees)
.UsingEntity<Dictionary<string, object>>(
"EmployeeTerritory",
l => l.HasOne<Territory>().WithMany().HasForeignKey("TerritoryId").OnDelete(DeleteBehavior.Restrict).HasConstraintName("FK_EmployeeTerritories_Territories"),
r => r.HasOne<Employee>().WithMany().HasForeignKey("EmployeeId").OnDelete(DeleteBehavior.Restrict).HasConstraintName("FK_EmployeeTerritories_Employees"),
j =>
{
j.HasKey("EmployeeId", "TerritoryId");
j.ToTable("EmployeeTerritories");
j.HasIndex(new[] { "EmployeeId" }, "FK_EmployeeTerritories_Employees");
j.HasIndex(new[] { "TerritoryId" }, "FK_EmployeeTerritories_Territories");
j.HasIndex(new[] { "EmployeeId", "TerritoryId" }, "PK_EmployeeTerritories").IsUnique();
j.IndexerProperty<int>("EmployeeId").HasColumnName("EmployeeID");
j.IndexerProperty<string>("TerritoryId").HasMaxLength(20).HasColumnName("TerritoryID");
});
I try to scaffold Northwind DB via
No errors, but
.cs
files forEmployeeTerritories
andCustomerCustomerDemo
tables are not generated. If I try to scaffold them individuallyI get the following error
It seems that tables list/order matters. If I use
I get no errors, as well as no
.cs
file for theEmployeeTerritories
tableI'm not an expert neither in C# nor in DBs, so any help would be appreciated.
.NET6 (SDK 6.0.302), FirebirdSql.EntityFrameworkCore.Firebird 9.0.2, Firebird (embedded) 4.0.1.2692 for Win64, Win 11 Pro