google-code-export / dblinq2007

Automatically exported from code.google.com/p/dblinq2007
Other
0 stars 0 forks source link

MySqlTransaction does not work with Datacontext which expects DBTransaction class (should be IDbTransaction) #295

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

1. Use MySql
2. Try to insert/save.

Don't use DbTransaction in the DataContex class. MySqlTransaction gives a throw 
error as it does not inherit DbTransaction. I changed DataContext to use 
IDbTransaction interface instead which worked a lot better !

Original issue reported on code.google.com by johan.ek...@gmail.com on 29 Nov 2010 at 9:21

GoogleCodeExporter commented 9 years ago
The reason we require DbTransaction and not IDbTransaction is because 
DbTransaction is exposed in the public API:

    http://msdn.microsoft.com/en-us/library/system.data.linq.datacontext.transaction.aspx

The correct fix is to use a more recent version of MySqlTransaction; the 6.3.5 
binaries inherit from the correct type:

    $ monop -r:v2/mysql.data.dll MySql.Data.MySqlClient.MySqlTransaction
    public sealed class MySqlTransaction : System.Data.Common.DbTransaction, 
            System.Data.IDbTransaction, IDisposable { ...

Original comment by jonmpr...@gmail.com on 29 Nov 2010 at 2:27