hi all, i'm using nhibernate with firebird as database.

i'm using the transaction-per-request pattern.

in a place of my application i 'm using the DbDataAdapter ado.net
object.

my code is samething as

DbProviderFactory m_Provider = ***;
DataTable myTable = ***;
using (DbDataAdapter adapter = m_Provider.CreateDataAdapter())
using (DbCommandBuilder builder = m_Provider.CreateCommandBuilder())
{
        builder.DataAdapter = adapter;
        adapter.SelectCommand = (DbCommand)
Session.Connection.CreateCommand();
        adapter.SelectCommand.CommandText = ***;

         ****
        adapter.Update(myTable);
}

i'm calling this code with net remoting, my server object is exposed
in a web application on IIS.

The problem is that i'm opening a nhibernate transaction for every web
request so i need to set every DbCommand to that transaction
(Execute requires the Command object to have a Transaction object when
the Connection object assigned to the command is in a pending local
transaction).

The adapter will generate internally the DbCommands to update/delete
so i cannot use the NhbernateTransaction.Enlist method.

The unique solution that i find is to get a reference to the
dbtransaction used internally by nhibernate and set it
to the adapter.SelectCommand (the generate DbCommand will use the
same).

So there's a way to get a reference to the DbTransaction created by
nhibernate or do you have same suggestion to integrate the usage of
dbdataadapter/dbcommandbuilder and nhibernate?

thanks

--

You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.


Reply via email to