473,396 Members | 2,082 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Component will not create a new transaction

Gidday people,

I had a bit of a problem this morning. I think I've got it sorted now, but I
wonder if anyone can shed some light.

I have a plain VBS WHS file that instantiates a component that controls an
interface file import process. This component, Controller, is part of
FinInterface.dll, and instantiates another component, Implementor (same
dll), that does the actual data access (an insert into a FinanceDataImports
table, and then multiple inserts into a child FinanceData table).

All the data access logic is in the Implementor class so I set the
MTSTransactionMode on this component to RequiresTransaction and did all the
right things with ObjectContext. I left the MTSTransactionMode set to
NotAnMTSObject for Controller class.

I created a new COM+ Services library application, configured *just* the
Controller class and thought I was away laughing.

To cut a long story short, during my testing I noticed that my transactions
weren't rolling-back (when I created error conditions). I tried heaps of
things, all the MTSTransactionMode settings on the Implementor class,
switching from Library to Server applications, configured and unconfigured
modes, and every time I found that the Implementor class would not run in a
transaction. I verified this by inserting a call to
mObjectContext.IsInTransaction() and raising an error if it returned False -
which it did - every time.

I sorted it out by also setting the MTSTransactionMode to
RequiresTransaction on the Controller class, and installing *both*
Controller and Implementor in the COM+ Services library application. Even
though the Controller object doesn't use the ObjectContext specifically (it
never calls GetObjectContext(), SetAbort(), SetComplete() or does any
database work), I guess the transaction is created when the first object
(Controller) is instantiated, and then it's used by the Implementor object.

I must admit this caught me a bit by surprise. I thought that any component
could get a reference to it's own ObjectContext regardless of how it's
instantiated. It looks like Implementor will only run in a transaction if
the calling component is configured as an MTS object, even if that first
object doesn't need a transaction.

Thanks for reading to the end. I hope I explained things well enough. Does
anyone have any thoughts on the behaviour here?

Cheers,

Alan
Jul 19 '05 #1
3 2559
do you use CreateObject to create objects?

you can't use New keyword and get the coclass creation interception COM+ is
doing. you have to go CreateObject (or CreateInstance) all the way through
COM libs.

New in VB is using a shortcut to create objects with a simple call to
object's constructor, jumping over all the COM (COM+) interception code.

HTH,
</wqw>
"Alan" <SP******************@inspire.net.nz> wrote in message
news:uk*************@TK2MSFTNGP12.phx.gbl...
Gidday people,

I had a bit of a problem this morning. I think I've got it sorted now, but I wonder if anyone can shed some light.

I have a plain VBS WHS file that instantiates a component that controls an
interface file import process. This component, Controller, is part of
FinInterface.dll, and instantiates another component, Implementor (same
dll), that does the actual data access (an insert into a FinanceDataImports table, and then multiple inserts into a child FinanceData table).

All the data access logic is in the Implementor class so I set the
MTSTransactionMode on this component to RequiresTransaction and did all the right things with ObjectContext. I left the MTSTransactionMode set to
NotAnMTSObject for Controller class.

I created a new COM+ Services library application, configured *just* the
Controller class and thought I was away laughing.

To cut a long story short, during my testing I noticed that my transactions weren't rolling-back (when I created error conditions). I tried heaps of
things, all the MTSTransactionMode settings on the Implementor class,
switching from Library to Server applications, configured and unconfigured
modes, and every time I found that the Implementor class would not run in a transaction. I verified this by inserting a call to
mObjectContext.IsInTransaction() and raising an error if it returned False - which it did - every time.

I sorted it out by also setting the MTSTransactionMode to
RequiresTransaction on the Controller class, and installing *both*
Controller and Implementor in the COM+ Services library application. Even
though the Controller object doesn't use the ObjectContext specifically (it never calls GetObjectContext(), SetAbort(), SetComplete() or does any
database work), I guess the transaction is created when the first object
(Controller) is instantiated, and then it's used by the Implementor object.
I must admit this caught me a bit by surprise. I thought that any component could get a reference to it's own ObjectContext regardless of how it's
instantiated. It looks like Implementor will only run in a transaction if
the calling component is configured as an MTS object, even if that first
object doesn't need a transaction.

Thanks for reading to the end. I hope I explained things well enough. Does
anyone have any thoughts on the behaviour here?

Cheers,

Alan

Jul 19 '05 #2
The Controller object is instantiated using CreateObject in the WSH script,
and then instantiates the Implementor object using the New keyword. Should I
try changing the Controller class to CreateObject/CreateInstance the
Implementor object?

Thanks for the reply.

Alan

"Vlad Vissoultchev" <wq****@nospam.myrealbox.com> wrote in message
news:er**************@tk2msftngp13.phx.gbl...
do you use CreateObject to create objects?

you can't use New keyword and get the coclass creation interception COM+ is doing. you have to go CreateObject (or CreateInstance) all the way through
COM libs.

New in VB is using a shortcut to create objects with a simple call to
object's constructor, jumping over all the COM (COM+) interception code.

HTH,
</wqw>
"Alan" <SP******************@inspire.net.nz> wrote in message
news:uk*************@TK2MSFTNGP12.phx.gbl...
Gidday people,

I had a bit of a problem this morning. I think I've got it sorted now, but
I
wonder if anyone can shed some light.

I have a plain VBS WHS file that instantiates a component that controls
an interface file import process. This component, Controller, is part of
FinInterface.dll, and instantiates another component, Implementor (same
dll), that does the actual data access (an insert into a

FinanceDataImports
table, and then multiple inserts into a child FinanceData table).

All the data access logic is in the Implementor class so I set the
MTSTransactionMode on this component to RequiresTransaction and did all

the
right things with ObjectContext. I left the MTSTransactionMode set to
NotAnMTSObject for Controller class.

I created a new COM+ Services library application, configured *just* the
Controller class and thought I was away laughing.

To cut a long story short, during my testing I noticed that my

transactions
weren't rolling-back (when I created error conditions). I tried heaps of
things, all the MTSTransactionMode settings on the Implementor class,
switching from Library to Server applications, configured and unconfigured modes, and every time I found that the Implementor class would not run in a
transaction. I verified this by inserting a call to
mObjectContext.IsInTransaction() and raising an error if it returned

False -
which it did - every time.

I sorted it out by also setting the MTSTransactionMode to
RequiresTransaction on the Controller class, and installing *both*
Controller and Implementor in the COM+ Services library application.

Even though the Controller object doesn't use the ObjectContext specifically

(it
never calls GetObjectContext(), SetAbort(), SetComplete() or does any
database work), I guess the transaction is created when the first object
(Controller) is instantiated, and then it's used by the Implementor

object.

I must admit this caught me a bit by surprise. I thought that any

component
could get a reference to it's own ObjectContext regardless of how it's
instantiated. It looks like Implementor will only run in a transaction if the calling component is configured as an MTS object, even if that first
object doesn't need a transaction.

Thanks for reading to the end. I hope I explained things well enough. Does anyone have any thoughts on the behaviour here?

Cheers,

Alan


Jul 19 '05 #3
that's what i meant. this way Implementor reference you get will be
intercepted by COM+ and it's transaction settings will be honored. btw, your
Controller will actually get a "fake" proxy :-))

as far as i know WSH couldn't possibly use New because it's nonexistent in
VBScript.

cheers,
</wqw>

"Alan" <SP******************@inspire.net.nz> wrote in message
news:#e**************@TK2MSFTNGP12.phx.gbl...
The Controller object is instantiated using CreateObject in the WSH script, and then instantiates the Implementor object using the New keyword. Should I try changing the Controller class to CreateObject/CreateInstance the
Implementor object?

Thanks for the reply.

Alan

"Vlad Vissoultchev" <wq****@nospam.myrealbox.com> wrote in message
news:er**************@tk2msftngp13.phx.gbl...
do you use CreateObject to create objects?

you can't use New keyword and get the coclass creation interception COM+ is
doing. you have to go CreateObject (or CreateInstance) all the way through
COM libs.

New in VB is using a shortcut to create objects with a simple call to
object's constructor, jumping over all the COM (COM+) interception code.

HTH,
</wqw>
"Alan" <SP******************@inspire.net.nz> wrote in message
news:uk*************@TK2MSFTNGP12.phx.gbl...
Gidday people,

I had a bit of a problem this morning. I think I've got it sorted now, but
I
wonder if anyone can shed some light.

I have a plain VBS WHS file that instantiates a component that controls an interface file import process. This component, Controller, is part of
FinInterface.dll, and instantiates another component, Implementor
(same dll), that does the actual data access (an insert into a

FinanceDataImports
table, and then multiple inserts into a child FinanceData table).

All the data access logic is in the Implementor class so I set the
MTSTransactionMode on this component to RequiresTransaction and did all the
right things with ObjectContext. I left the MTSTransactionMode set to
NotAnMTSObject for Controller class.

I created a new COM+ Services library application, configured *just*
the Controller class and thought I was away laughing.

To cut a long story short, during my testing I noticed that my

transactions
weren't rolling-back (when I created error conditions). I tried heaps of things, all the MTSTransactionMode settings on the Implementor class,
switching from Library to Server applications, configured and

unconfigured modes, and every time I found that the Implementor class would not run in
a
transaction. I verified this by inserting a call to
mObjectContext.IsInTransaction() and raising an error if it returned

False -
which it did - every time.

I sorted it out by also setting the MTSTransactionMode to
RequiresTransaction on the Controller class, and installing *both*
Controller and Implementor in the COM+ Services library application.

Even though the Controller object doesn't use the ObjectContext specifically (it
never calls GetObjectContext(), SetAbort(), SetComplete() or does any
database work), I guess the transaction is created when the first
object (Controller) is instantiated, and then it's used by the Implementor

object.

I must admit this caught me a bit by surprise. I thought that any

component
could get a reference to it's own ObjectContext regardless of how it's
instantiated. It looks like Implementor will only run in a transaction

if the calling component is configured as an MTS object, even if that first object doesn't need a transaction.

Thanks for reading to the end. I hope I explained things well enough. Does anyone have any thoughts on the behaviour here?

Cheers,

Alan



Jul 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: David Morgan | last post by:
Hello All Back in the day, when I was up to my elbows in Site Server 3 Commerce Edition, there was a SMTP Component that supported transactions. If the mail could not be delivered the...
0
by: Steve Jorgensen | last post by:
I'm posting a link here because I'm hoping it will be as enlightening to other Access developers as it has been to me. ...
8
by: Don Riesbeck Jr. | last post by:
I have an C# EnterpriseService component that is part of an application I am developing that is responsible for writing data to an SQL Server. (it reads from a local DB (MSDE), then writes to a...
11
by: Hazz | last post by:
is there something as easy as just providing a link to an inexpensive credit card approval/payment component to integrate into an asp.net app. My question isn't about the linking process itself but...
7
by: Alan Silver | last post by:
Hello, I've just been looking at the free PayPal component from ComponentOne and am somewhat amazed how insecure it is. They include all the transaction details in plain text in the querystring,...
3
by: gabe | last post by:
I have a general design question. What's a 'Best Practice' for middle tier component design? I'm thinking of a web form that contains data from multiple tables. The data is supplied from one...
5
by: Stuart Dee | last post by:
Hi, I have created a com+ component with vb dot net using jit activation and transactions If i call it like this x=createobject("mycomp") x.dispose
0
by: Pieter | last post by:
Hi, When using clickOnce for a VB.NET 2.0 application it installs fine on every computer, except one (a new one...). Every is isstalled, Framework, Mdac, .... The error in the log file is:...
0
by: bharathreddy | last post by:
In .Net COM+ components are referred to as serviced components, Namespace: System.EnterpriseServices; Advantage of Serviced Components: object pooling, database connection pooling,
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.