I am trying to build a NpgsqlSimpleTypeHandler<ulong> to handle converting ulong values to long values so they can be stored in my PostgreSQL database, and vise-versa.
When I try and call Npgsql's Int64handler.ValidtaeAndGetLength after converting a ulong to a long with Convert.ToInt64(value), attempting to pass the newly converted long gives me an ambiguous method call error.
private readonly Int64Handler handler;
...
public override int ValidateAndGetLength(ulong value, NpgsqlParameter? parameter)
{
long val = Convert.ToInt64(value);
return handler.ValidateAndGetLength(val, parameter);
}
Error Message:
Error CS0121
The call is ambiguous between the following methods or properties:
'Int64Handler.ValidateAndGetLength(float, NpgsqlParameter?)' and
'Int64Handler.ValidateAndGetLength(decimal, NpgsqlParameter?)'
Why, when even with Int64Handler.ValidateAndGetLength(long, NpgsqlParameter?) exsisting, do I wind up with the ambiguous method call error?
Npgsql Int64Handler documentation
[7/21/2020 14:23 EST] Updated tags to include C#-8.0