issue with UniParameter.SourceColumnNullMapping
Posted: Fri 19 Mar 2010 10:50
Hello,
I've also submitted this via the "contact us" page, but unfortunately I don't seem to getting any emails from devart through to my work address, so apologies for the multiple submissions!
We are currently evaluating dotConnect Universal for use in our application. We have found what appears to be a
bit of a show-stopper bug for us in the implementation of UniParameter.
Looking at the code for UniParameter in reflector, it appears that the underlying provider parameter (e.g. SqlParameter) is
lazily instantiated. However, when this underlying parameter is created, the value of the SourceColumnNullMapping property
is not copied. This means that the value of SourceColumnNullMapping is 'forgotten', and becomes false even if it was
initially set to true.
Code to demonstrate the bug is:
The effect of this bug is that queries generated using the strongly typed dataset designer (i.e. via DbCommandBuilder) which use parameters of the form @IsNull_* end up throwing an exception.
Thanks in advance for your help!
I've also submitted this via the "contact us" page, but unfortunately I don't seem to getting any emails from devart through to my work address, so apologies for the multiple submissions!
We are currently evaluating dotConnect Universal for use in our application. We have found what appears to be a
bit of a show-stopper bug for us in the implementation of UniParameter.
Looking at the code for UniParameter in reflector, it appears that the underlying provider parameter (e.g. SqlParameter) is
lazily instantiated. However, when this underlying parameter is created, the value of the SourceColumnNullMapping property
is not copied. This means that the value of SourceColumnNullMapping is 'forgotten', and becomes false even if it was
initially set to true.
Code to demonstrate the bug is:
Code: Select all
using (UniConnection conn = new UniConnection(connectionString)) {
conn.Open();
using (UniCommand command = conn.CreateCommand()) {
command.CommandText = "SELECT @test";
UniParameter param = new UniParameter() {
ParameterName = "@test",
DbType = DbType.Int32,
UniDbType = UniDbType.Int,
SourceColumnNullMapping = true,
Value = 0,
};
command.Parameters.Add(param);
Console.WriteLine(param.SourceColumnNullMapping); // prints true
// this causes the underlying SqlParameter to be created.
command.ExecuteScalar();
Console.WriteLine(param.SourceColumnNullMapping); // prints false
}
}
Thanks in advance for your help!