I have a very similar question to Dapper-dot-net "no column name", but the answer there is not getting me where I need.
I'm writing a web interface and using dapper to get data from Stored Procedures from my client's ERP system. The SP returns 4 columns of data without column names. That being said the SP's are locked and I can't change them. I've tried to work around this by using a temp table in my query as Sam suggested.
var grid = QueryMultiple(@"set nocount on
declare @t table(Id int, Name nvarchar(max), AnotherId int)
insert @t
exec proc
set nocount off
select Id, Name from @t
select Id, AnotherId from @t
");
However, I've now discovered the original SP also contains an insert for logging and therefore SQL will not allow me to insert my sp into a temp table because of this.
There is mention of adding support for:
class Foo { [ColumnNumber(1)] public string Name {get;set;} }
How can I do this? Can someone point me in the right direction to modify Dapper source to not require column names and allow me to map by column number?
See Question&Answers more detail:os