Question about serviced components and transaction contexts -
08-06-2004
, 04:38 PM
Hi everyone,
I think this is a simple one.
I have two VB .Net serviced components using COM+ transactions. The
"parent" class has a transaction attribute of RequiresNew, while the "child"
class has a transaction attribute of Requires. The AutoComplete attribute
has been set on all applicable methods in both classes.
My app creates a parent class and calls a method on it. This method in
turn creates the child and calls one of *its* methods, which opens a
SqlConnection and reads some data from a table. Nothing fancy.
I've been experimenting, and have noticed that if I intentionally "mess
up" the child's data access (by, for instance, reading from a non-existant
table), the transaction still completes-- at according to the COM+
statistics page. I don't see how that could be, unless maybe I'm creating
the child and parent objects incorrectly?
At present, I'm using the New operator to create my parent and child
objects. Is that ok in .Net, or should I use a TransactionContext object
when building them? I've seen code samples use the New operator, so I'm a
little skeptical of changing things, but I'm obviously doing something
wrong.
If what I've described sounds familiar to you, or if you know of any
gotchas I may be stepping on here, I'd love to hear from you. Thanks for
the help.
-Jim |