Anything exposed as COM/COM+ can't be static, but it can call static
methods of other non-COM+ classes.
I don't think it's wise to have much processing in a COM+ constructor.
It can be nasty if an exception occurs in the constructor - will the
class instance still be created? How will the memory be freed? How will
the COM caller handle an exception rasied in the constructor?
I like to keep the COM+ constructors as light as possible. I put the
"heavy" processing in an "Init" method that I define inside the same
class. That way the constuction will succeed, and if there's a problem
in the Init method, the caller will still have an instance to the
object, so there's a well defined state at all times.
Eric
Chee Pin Cheam - 17 Mar 2005 02:07 GMT
> Anything exposed as COM/COM+ can't be static, but it can call static
> methods of other non-COM+ classes.
[quoted text clipped - 11 lines]
>
> Eric
Eric is right. Nothing in COM+ can be static due to context sensitivity.
If you have long initialization for your component, you can consider
using object pooling features of COM+. It is normally helpful for
component that has long initialization time.
Chee Pin