-
Notifications
You must be signed in to change notification settings - Fork 23
Sorted properties from custom context #57
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
Conversation
Fixed typo in ConnectionDialog label
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. Will merge later when we are ready to release new version. Want to check if it is really random or use column ordinal
It's not column ordinal as it doesn't make a call to the database when generating the tree. From some test I am doing it looks to be in the order that the properties are in the source (which is logical) but I doesn't always seem to be this way as the context I was originally trying this with has the properties in alphabetic order. I don't have this to had today but I'll do some more tests to confrm this and that the fix actually works. Leave it with me. |
Ah, you are right. Here we load columns using reflection. Usually it is ordered by declaration order in source code due to implementation, but as it documented here it is not always true :) |
@@ -54,6 +54,7 @@ public IEnumerable<ExplorerItem> GetSchema() | |||
.Where(p => | |||
p.GetCustomAttributeLike<ObsoleteAttribute>() == null && | |||
p.PropertyType.MaybeChildOf(typeof(IQueryable<>))) | |||
.OrderBy(p => p.Name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest to sort by ColumnAttribute.Order
for columns with HasOrder
and by name for rest
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The original change will sort the tables. I'm still trying to sort the columns but I will honor the ColumnAttribute if the order is specified.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure of helpful, but here we apply similar sorting for columns in create table based on Order: https://github.com/linq2db/linq2db/blob/master/Source/LinqToDB/SqlProvider/BasicSqlBuilder.cs#L1111
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tables and columns shold now sort by name honouring column attribute order if applicable
Sorted properties from custom context
Fixed typo in ConnectionDialog label
Fixes #56