c# - Dapper function doesn't map the string values from stored procedure, but maps the other values correctly -
i have stored procedure returns data in following format:
"companyid"|"metadataid"|"mnemonic"|"short"|"format"|"metadatatype"|"lngvalue"|"decvalue"|"charvalue"|"datevalue"|"blnvalue"|"sorder"|"version"|"type"|"sortorder"|"createddate"
the strings mnenomic
, short
. sp returns multiple rows why thinking using ienumerable<myclass>
best way map rows.
my class mapping data:
public class creditdatareport { public int companyid { get; set; } public int metadataid { get; set; } public string mnenomic { get; set; } public string shortdesc { get; set; } public int format { get; set; } public int metadatatype { get; set; } public int lngvalue { get; set; } public double decvalue { get; set; } public string charvalue { get; set; } public datetime datevalue { get; set; } public int? blnvalue { get; set; } public int sorder { get; set; } public int version { get; set; } public int type { get; set; } public int sortorder { get; set; } public datetime createddate { get; set; } }
and method calling sp , mapping data:
public ienumerable<creditdatareport> getcreditrecommendation(int reportid) { dynamic result = connection.query<creditdatareport>("cor_creditratiodataxxgetbyreportid", new { reportid = reportid }, transaction: this.transaction, commandtype: commandtype.storedprocedure); return result; }
my problem when call function var testing = getcreditrecommendation(2).tolist();
, walk through code @ runtime see data correctly mapped corresponding value in creditreportdata
class except 2 string values mnenomic
and short
.
what missing in code , using dapper in wrong way?
mnemonic
!= mnenomic
(look very carefully)
short
!= shortdesc
Comments
Post a Comment