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
{{ message }}
Repository navigation
Table column order doesn't follow class property order #2269
In 7.0.0-beta3 and EF6, migrations create table columns in the same order that the properties appear in the entity classes. In 7.0.0-beta4, migrations no longer respect this ordering.
Column order makes a big difference to the debugging and support experience when using SQL Management Studio for example. If I'm on a support call and do a quick select * from something, the results are presented in an intuitive way without additional effort. I don't have to scroll sideways through 30 columns to pick out the primary information - it's always at the front. StartDate and EndDate are next to each other and easily compared. RequestedBy and ApprovedBy are grouped together and appear in the same order as the business processes that use them.
Developers specify entity class properties in an order that makes sense. Please reflect that in the generated tables.
@jdaley We can't match the declared syntactic order because we discover properties via reflection, and that order is non-deterministic.
In EF6 column order could be controlled via the HasColumnOrder fluent API or the ColumnAttribute data annotation. I've created #2272 to track this in EF7.
Just to add to this, when we tried to use reflection order in past releases of EF we ended up with a number of bugs because we would get properties in a different order on different processors.
Activity
anpete commentedon May 26, 2015
@jdaley We can't match the declared syntactic order because we discover properties via reflection, and that order is non-deterministic.
In EF6 column order could be controlled via the HasColumnOrder fluent API or the ColumnAttribute data annotation. I've created #2272 to track this in EF7.
rowanmiller commentedon May 29, 2015
Just to add to this, when we tried to use reflection order in past releases of EF we ended up with a number of bugs because we would get properties in a different order on different processors.