dapper - return a list of INT

I think that you should specify the type you expect from your query like below:

var ids = connection.Query<int>("storedprocedure", 
                                param, 
                                transaction: transaction, 
                                commandType: CommandType.StoredProcedure);

You could check this Execute a query and map the results to a strongly typed List for further info.


This is very similar but with .ToList() as IList<int>

var ids = connection.Query<int>("storedprocedure", 
param, transaction:transaction, commandType: CommandType.StoredProcedure)
.ToList() as IList<int>

Tags:

C#

Dapper