session.Transaction.Enlist(yourcmd);

/Oskar


2010/10/19 PLen <[email protected]>:
>
> A part 2 to the original question.....
>
> I found that I could do the following:
>
> IEventSource evtSrc = @event.Session;
> ISession session = evtSrc.GetSession(EntityMode.Poco);
> IDbConnection conn = session.Connection;
> ITransaction trans = session.Transaction;    // The connection does
> not have an option to get the current transaction.
>
> I need this info so that I can do an SQL UPDATE via a command:
>
> IDbCommand cmd = conn.CreateCommand();
> cmd.Transaction = trans;  // THROWS AN EXCEPTION
>
> The problem I run into here is that the IDbCommand requires an
> IDbTransaction, not an ITransaction.  I also cannot do the following:
>
> IDbTransaction trans = conn.BeginTransaction();
>
> because I would be starting a transaction within a transaction, which
> is a no go.  So, I guess my real question is whether I can run an SQL
> command to do an update during the OnPostInsert, which is called
> during an ongoing transaction.  I am trying to do it this way because
> another project using a different O/R mapper is successfully doing it
> and it keeps me from doing sequential transactions which would then
> make a rollback difficult.
>
> Thoughts?
>
> --
> 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.
>
>

-- 
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