Use CreateInstance Compared to CreateObject and New in MTS

Use CreateInstance Compared to CreateObject and New in MTS

The New keyword in VB is used to create a new instance of a class as an object for use within the current application. When used in a component within Microsoft Transaction Server (MTS), it creates a Private instance of an object that MTS knows nothing about. It won’t have its own context object, and won’t be included within the current transaction. In other words, it has to look after itself with no help from MTS. The CreateObject method is almost exactly the opposite. When used in a component running within MTS, this method creates a new instance of an object that MTS will treat as separate from the current component instance and it will get its own context object. However, the new instance will not contain any information from the context of the component that created this new instance, so it will run outside the current transaction. The CreateInstance method of the context object provides a solution to these two problems. It creates a new instance of the referenced component and provides it with a new context object. However, it also copies the transaction information from the context of the object that created it into the new context thus making it part of the current transaction. Therefore, you should use CreateInstance as opposed to CreateObject and New as it is more versatile in MTS environment.

Share the Post:
Heading photo, Metadata.

What is Metadata?

What is metadata? Well, It’s an odd concept to wrap your head around. Metadata is essentially the secondary layer of data that tracks details about the “regular” data. The regular

XDR solutions

The Benefits of Using XDR Solutions

Cybercriminals constantly adapt their strategies, developing newer, more powerful, and intelligent ways to attack your network. Since security professionals must innovate as well, more conventional endpoint detection solutions have evolved

AI is revolutionizing fraud detection

How AI is Revolutionizing Fraud Detection

Artificial intelligence – commonly known as AI – means a form of technology with multiple uses. As a result, it has become extremely valuable to a number of businesses across

AI innovation

Companies Leading AI Innovation in 2023

Artificial intelligence (AI) has been transforming industries and revolutionizing business operations. AI’s potential to enhance efficiency and productivity has become crucial to many businesses. As we move into 2023, several

data fivetran pricing

Fivetran Pricing Explained

One of the biggest trends of the 21st century is the massive surge in analytics. Analytics is the process of utilizing data to drive future decision-making. With so much of