Re: [sqlite] System.Data.SQLite: Commit and Rollback set Connection tonull

2013-01-09 Thread RizThon
> The Connection property is not guaranteed by the MSDN documentation to
> remain valid after a call to Commit or Rollback.  It's really an internal
> implementation detail.
>
>
> http://msdn.microsoft.com/en-us/library/system.data.idbtransaction.connection.aspx
>
Indeed, I already checked MSDN about that. It just didn't sound logical to
me that Connection is set to null after doing a Commit or Rollback, but
indeed the current implementation uses that fact. So I guess I'll have to
use the following code instead
DbConnection connection = transaction.Connection;
transaction.Rollback();
connection.Close();

Thanks.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] System.Data.SQLite: Commit and Rollback set Connection tonull

2013-01-09 Thread Joe Mistachkin

RizThon wrote:
>
> I don't know if it's the right mailing list to talk about
> System.Data.SQLite.dll.
>

Yes, this is the right place.

> 
> DbTransaction has a property Connection that corresponds to the connection
> used by the transaction. I don't understand why calling Commit or Rollback
> on the transaction automatically sets that property to null. 
> 

Yes, because it's making sure that nobody can accidentally "use" the
transaction
after that point.

> 
> I'm using an abstraction layer to be able to target different databases,
> and at least "MySQL Connector .Net" has a more normal behaviour (at least
> to me) as it doesn't change the Connection property.
> 

The Connection property is not guaranteed by the MSDN documentation to
remain
valid after a call to Commit or Rollback.  It's really an internal
implementation
detail.

http://msdn.microsoft.com/en-us/library/system.data.idbtransaction.connectio
n.aspx

--
Joe Mistachkin

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users