Performing an Oracle Transaction using C# and ODP.NET

后端 未结 1 2016
忘了有多久
忘了有多久 2021-02-05 15:39

I\'m confused. On the face of it, performing a transaction in C# seems simple. From here:

http://docs.oracle.com/cd/B19306_01/win.102/b14307/OracleTransactionClass.htm

相关标签:
1条回答
  • 2021-02-05 16:13

    1) do I need to set the Transaction property of my OracleCommand,

    No.

    and if so, what exactly does this do?

    It's a no-op.

    The OracleCommand automatically "reuses" the transaction that is currently active on the command's OracleConnection. The Transaction property is there simply because it was declared in the base class (DbCommand) and you cannot "undeclare" a member in the inherited class. If you read it you'll get the connection's transaction (if any), setting it does nothing.

    2) If I've started a transaction on a connection, are ALL subsequent commands performed on that connection (until a commit or rollback) part of that transaction, even if I don't set the Transaction property on those commands?

    Exactly.

    0 讨论(0)
提交回复
热议问题