
Using New to create instances of a class in MTS componant
The CreateObject has implementation on the backside that you are not exposed
to that hooks into the MTS/COM+ structure that allows for proper reference
counting and thread handling. The new operator will not generate the proper
implementation to allow MTS/COM+ to handle the object in the correct manor.
You may want to read up on these technologies to get a better understanding
of the guts before implementing them. I think while Microsoft makes
technology that is easy to use their sales team promotes it as blackbox
(don't have to know how it works just use it). This should never be the
case.
Steven Szelei
Quote:
> This snippit comes from
> Platform SDK: Transaction Server
> Creating MTS Objects.
> Can someone explain what exactly it means not to use the New keyword to
> create an instance of a class in the current MTS project..... Do they
> expect me to change all of my MTS objects to use createobject? Obviously
> this would only be for public creatable classes but still...... I am
trying
> to still understand what this means......
> --------
> Important Do not use the New operator, or a variable declared As New, to
> create an instance of a class that is part of the active project. In this
> situation, Visual Basic uses an implementation of object creation that
does
> not use COM. To prevent this occurrence, it is recommended that you mark
all
> objects passed out from a Visual Basic componentas Public Creatable, or
its
> equivalent, and created with either the CreateObject function or the
> CreateInstance method of the ObjectContext object.