How to set "native" db types when passing parameters, e.g., NpgsqlDbType / SqlDbType / or just parameter.TypeName / etc.)

31 Views Asked by At

I'm trying to figure out a way to set "native" db type, such as:

when using DynamicParameters.

without writing a lot of boilerplate code, I can only see two method overloads, namely:

public void Add(string name, object? value, DbType? dbType, ParameterDirection? direction, int? size)
{...}

public void Add(string name, object? value = null, DbType? dbType = null, ParameterDirection? direction = null, int? size = null, byte? precision = null, byte? scale = null)
{...}

They obviously only support DbType, and while I've found some workaround in this SO answer, it looks really tedious just to change the type, I thought there would have been some option to pass the native db type name directly as a workaround, but this option is not available either.

0

There are 0 best solutions below