X Tutup
Skip to content

Dynamic type parameters: Cannot cast System.Int32 into any valid DbType after upgrading from 2.0.14.3 to 2.1.2.0 #201

@gdau

Description

@gdau

Hi,

After upgrading to 2.1.2.0 I am getting an error "Can't cast System.Int32 into any valid DbType." originating from the setter "public override Object Value" within NpgsqlParameter.cs.

I am using dapper.net and I have calls like this:

var template = builder.AddTemplate(@"
SELECT * FROM users
LIMIT :limit",
new
{
    limit = null as object
 });

This is stripped-down so doesn't necessarily make sense in this context, but I can fix it if I change

limit = null as object

to

limit = null as Int32?

Is the previous method supported? I just wanted to make sure this is by-design before I go about changing all the places where this is used. I have confirmed that in 2.0.14.3 this code works 100%.

Kind Regards,

Gav

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      X Tutup