Mapping return fields with spaces

Sep 29, 2015 at 8:53 AM
I am using code first approach for stored procedures and it works for one word return fields, but it throws an error for columns with multiple words (which contains white spaces).
For instance SP returns column 'Ja bekreftet' and in SP_Result variable name is Ja_bekreftet (with underscore instead of white space), so I get the following error: ' A member of the type, 'Ja_bekreftet', does not have a corresponding column in the data reader with the same name.'
Can it be solved somehow?
Thx in advance,
Oct 9, 2015 at 9:06 PM
I think one issue is that when the convention is building the return row type it does not look at the column attribute but uses the property name as the column name. The other thing is that I am not sure if the mapping layer allows to specify this kind of mapping. A workaround for this issue could be to not use this convention but invoke the stored procedure using the .SqlQuery function - take a look at this SO thread for some samples (towards the bottom of the page). Obviously you could try renaming the column in the database but I don't think it is feasible in the majority of cases.