Question
I am working on a provider that requires a strict order of it's DbParameters on the DbCommand. The order they are inserted into the collection defines how they map up to replacement characters in the SQL string. Basically, I believe, exactly like the OdbcCommand:
The order in which OdbcParameter objects are added to the OdbcParameterCollection must directly correspond to the position of the question mark placeholder for the parameter in the command text.
This seems a little difficult to accomplish in EF.
RelationalCommand.CreateDbCommand loops over the parameters dictionary. Except, that's a dictionary. So the order is undefined. I figured I could maybe override CreateDbCommand and just do it myself, maybe sorting on name, and then assign something sortable in name. Except all I have access to here is InvariantName. Which isn't necessarily what my name generator returns. Some of them have "p" for InvariantName.
So what's the best option here? There doesn't seem to be anything to maintain the order all the way through. And it doesn't seem I can attach information to later sort by a specific order.
Your code
Stack traces
Verbose output
EF Core version
10.0.0
Database provider
No response
Target framework
No response
Operating system
No response
IDE
No response
Question
I am working on a provider that requires a strict order of it's DbParameters on the DbCommand. The order they are inserted into the collection defines how they map up to replacement characters in the SQL string. Basically, I believe, exactly like the OdbcCommand:
This seems a little difficult to accomplish in EF.
RelationalCommand.CreateDbCommand loops over the parameters dictionary. Except, that's a dictionary. So the order is undefined. I figured I could maybe override CreateDbCommand and just do it myself, maybe sorting on name, and then assign something sortable in name. Except all I have access to here is InvariantName. Which isn't necessarily what my name generator returns. Some of them have "p" for InvariantName.
So what's the best option here? There doesn't seem to be anything to maintain the order all the way through. And it doesn't seem I can attach information to later sort by a specific order.
Your code
Stack traces
Verbose output
EF Core version
10.0.0
Database provider
No response
Target framework
No response
Operating system
No response
IDE
No response