New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AddWithValue with custom types converting #410
Comments
Is the workaround I'd like to do some testing to evaluate how other ADO.NET connectors handle this situation. |
As far as I can tell, Connector/NET treats all unknown types as blob. This will be handled by If this is being inserted in a There's so much "magic" and opportunity for failure here that I'm very reluctant to clone this behaviour. Moreover, this appears to be very non-standard among ADO.NET connectors; dotConnect, Microsoft.Data.Sqlite, Npgsql, and SqlClient all forbid a custom type being used directly as |
Not implementing, for the reasons given above, and because an easy workaround (calling |
Another good reason to not automatically call In #943, the user wanted to set In MySqlConnector, this threw an exception with a clear message: the type is not supported. In MySQL Connector/NET, the driver calls |
In Connector/NET
AddWithValue(string parameterName, object value);
cast value parameter into byte[] or string if it's not a one of the known types.MySqlConnector instead use another logic. If it couldn't find a
value
type the exception will be thrownParameter type {0} (DbType: {1}) not currently supported. Value: {2}
The problem occures because we have own low-level type UUId which can be cast to string and byte[]. This type is VARCHAR(30) into mysql stored procedures parameters.
In code it may looks like this:
Also it's not possible to create extension to
public MySqlParameter AddWithValue(string parameterName, object value)
to fix this problemThe text was updated successfully, but these errors were encountered: