Migrations: Complex property order incorrect in CreateTable
- Dominant language
- C#
- Stars
- 14.8k
- Forks
- 3.4k
- PR merge metrics
- PR metrics pending
Description
Here's a failing test illustrating the issue.
```cs
partial class MigrationsModelDifferTest
{
private class CreateTableEntity2
{
public int Id { get; set; }
public int E { get; set; }
public CreateTableEntity2B D { get; set; }
public int A { get; set; }
}
private class CreateTableEntity2B
{
public int B { get; set; }
public int C { get; set; }
}
[ConditionalFact]
public void Create_table_columns_uses_complex_property_order()
=> Execute(
_ => { },
modelBuilder => modelBuilder.Entity().ComplexProperty(e => e.D),
operations =>
{
var operation = Assert.IsType(Assert.Single(operations));
Assert.Collection(
operation.Columns,
x => Assert.Equal("Id", x.Name),
x => Assert.Equal("E", x.Name),
x => Assert.Equal("D_B", x.Name), // Fails! Complex properties are at the end
x => Assert.Equal("D_C", x.Name),
x => Assert.Equal("A", x.Name));
});
}
```
Contributor guide
Assessment
This issue has not been assessed yet.