Closed AlejandroFerrandiz closed 4 years ago
Take a look at the XML Tests since the usage you are describing is not gonna give return you the behavior you expect.
I will try and take some time to add some query result scenarios to the wiki page
I added a test case to make sure that SingleAsync
performed XML Parsing. It works fine.
The issue is that you are expecting Insight to consider the first COLUMN as the root object. Instead, Insight treats the ROW as the root object, even when you are selecting a Single
.
The returned recordset is:
Row 0
Column Response = xml
To parse this properly you would need to return it into an object like this:
class RecordsetWithResponse {
public MyResponse Response;
}
....
.SingleAsync<RecordsetWithResponse>(....)
Then Insight will map Row 0 to a new RecordsetWithResponse, and then parse the Response xml column into your object structure.
Note that XML parsing is not implemented for ExecuteScalar, as IDbCommand.ExecuteScalar automatically converts the XML to a string and we have no way of detecting that.
Describe the bug
I'm calling a Stored Proc that return XML and I'm trying to map that to an Object but is mapping all null.
Steps to reproduce
My Object
Stored proc
Stored proc call
if I replace MyResponse by string
result == <MyResponse><Result>Error</Result><Errors><Error><RowNbr>1</RowNbr><Description>BC5081</Description></Error></Errors></MyResponse>
Expected behavior