Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reveng: entity class properties in the same order of table fields #4062

Closed
alfberga opened this issue Dec 13, 2015 · 9 comments
Closed

Reveng: entity class properties in the same order of table fields #4062

alfberga opened this issue Dec 13, 2015 · 9 comments
Assignees
Labels
closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. providers-beware type-enhancement
Milestone

Comments

@alfberga
Copy link

In reverse engineer please consider to generate (eventually optional) the entity class with (field) properties listed not in alphabetic order but in the same order of the fields in related table.

@rowanmiller rowanmiller added this to the 7.0.0-rc2 milestone Dec 16, 2015
@rowanmiller rowanmiller changed the title Reveng: entity class properties in the same order of table fields (optionally) Reveng: entity class properties in the same order of table fields Dec 22, 2015
@rowanmiller
Copy link
Contributor

Triage: We should just do this, it doesn't need to be optional though.

@ahmad-moussawi
Copy link

The same for code first approach would be nice, so the columns in the database should be in the same order as the model classes

@rowanmiller
Copy link
Contributor

@ahmad-moussawi there has been a lot of discussion around that (and it's what we tried to do in EF6) but it causes a bunch of issues because reflection can give the properties in a different order on different architectures. While theoretically this doesn't really change the model... it can have subtle impacts on conventions etc. which ends up with different models on different architectures and it is super hard to debug why the differences occur.

@ahmad-moussawi
Copy link

@rowanmiller thanks for the clarification, so it would be useful if we can set it by annotation attributes (I don't know if this was already implemented but at least I didn't find it in the docs) especially for the Id column, where am expecting to be always the first column.

Maybe [Order("First")] or [Order("Last")] or maybe also something like [Order(0)] for the 1st one, [Order("n-1")] for the 2nd from the end

@rowanmiller
Copy link
Contributor

@ahmad-moussawi see #2272 for some ideas we have on providing a hint to migrations to the order columns would be in - which would often give you the order you defined things in the class (or at least close to it).

@lajones
Copy link
Contributor

lajones commented Jan 11, 2016

Note to providers: this is now implemented. And you probably won't need to do anything. But if you override RelationalScaffoldingModelFactory.VisitColumn() and you don't call base.VisitColumn() then you will need to make sure the same ColumnOrdinal annotation is added yourself.

@ktrkumarbablu
Copy link

Can anyone has resolve this issue.I tried find the solution but completely unsuccessful...
Please look this issue..

@icecream520
Copy link

also has problem

@bricelam
Copy link
Contributor

@icecream520 Can you submit a new issue with additional details about what you're seeing?

@ajcvickers ajcvickers removed this from the 1.0.0-rc2 milestone Oct 15, 2022
@ajcvickers ajcvickers added the closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. label Oct 15, 2022
@ajcvickers ajcvickers added this to the 1.0.0 milestone Oct 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. providers-beware type-enhancement
Projects
None yet
Development

No branches or pull requests

8 participants