transactionscom+servicedcomponent

Nested components with [AutoComplete]


Let's assume that I got two ServiceComponent classes which I use like this:

using (var outer = new MyComponent1())
{
    string data;
    using (var inner = new MyComponent2())
    {
        data = inner.GetFromQueue();
    }

    outer.Process(data);
}

Both MyComponent1 and MyComponent2 uses the [AutoComplete] attributes on their methods.

Will MyComponent2 commit when being disposed or will it wait on the transaction started by MyComponent1?


Solution

  • AutoComplete is not required. COM+ works fine as long as you let exceptions propagate up the call stack.

    Just make sure that all components are disposed properly or the transactions will timeout.