0

As far as I know SQL expects the columns of passed DataReader to have the same order as the columns of user defined type.

At the same time MSDN says:

The GetProperties method does not return properties in a particular order, such as alphabetical or declaration order. Your code must not depend on the order in which properties are returned, because that order varies.

So it implies that the only attributeless safe order of properties is alphabetical, isn't it? That is when I create some utility method to wrap a collection of entities with DataReader which is later passed as parameter to SP call.

Is my understanding correct or may be some magic exists which allows to avoid ordering problems?

Community
  • 1
  • 1
Pavel Voronin
  • 13,503
  • 7
  • 71
  • 137
  • No; read the quote you linked to. The parameters must be named, and be referred to by name and not by position index or sequencing. – Pieter Geerkens Aug 29 '14 at 13:30
  • First, what do you mean by "parameters must be names"? Second, it is SQL Server (or whatever) that accesses DataReader. Debug shows that columns are accessed by external code via index, not via name. – Pavel Voronin Aug 29 '14 at 13:52

0 Answers0