martinjw / dbschemareader

Read database metadata (from SqlServer/Oracle/MySql/SQLite/PostgreSql/DB2 etc) into one simple model
Microsoft Public License
293 stars 128 forks source link

Stored procedure arguments order by ordinal #99

Closed bugproof closed 5 years ago

bugproof commented 5 years ago

Just took a quick look and ORDER BY is the cause (seems to be similar in all implementations): https://github.com/martinjw/dbschemareader/blob/1612b7242f8989ce29f046fbb174a8738210eb33/DatabaseSchemaReader/ProviderSchemaReaders/Databases/SqlServer/ProcedureArguments.cs#L47

I think it would be better to remove it or order by ORDINAL_POSITION. But still it can be solved like:

storedProcedure.Arguments.OrderBy(arg => arg.Ordinal)

The question is: wouldn't it be better if it was ordered by ordinal by default?

martinjw commented 5 years ago

The ordering is there - in argument.Ordinal - but not applied in the model. In some places (SqlGen) it's ordered by using the ordinal, but it should be done directly in the model. Fix coming soon.

martinjw commented 5 years ago

Released in 2.7.2