Skip to content

why dapper return Int64 ? #524

@cdmin207078

Description

@cdmin207078
var sql = @"select count(1) from Products;
                            select * from Products order by ProductId asc limit @ItemsPerPage Offset @Offset";

                using (var multi = _db.Connection.QueryMultiple(sql, new { ItemsPerPage = page.ItemsPerPage, Offset = (page.CurrentPage - 1) * page.ItemsPerPage }))
                {
                    var totalitems = multi.Read<int>().Single();
                    var data = multi.Read<Product>().ToList();
                }

Above is wrong. and push a `System.InvalidCastException'

If I change the following way ,it's correct ?

var totalitems = multi.Read<Int64>().Single();

Is a Bug ?

However, the query does not have this problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions