|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
From: Julian Anigbogu (anigbogu
AUSTIN.APC.SLB.COM)Date: Wed Apr 10 2002 - 10:54:03 CDT
Hi,
I'm trying to create a COM+ configured component that transacts operations
into SQL server. I'm trying to use the "Auto-done" feature of COM+ whereby
SetAbort and SetComplete get called automatically depending on whether an
exception was triggered or not. This worked fine while I was in VS6, but
I've moved to VS .NET and things don't work as documented.
I first noticed that transactions didn't seem to be completing. I checked
under synchronization and noticed that the Threading Model read "Main Thread
Apartment". This looked strange to me and so I decided to check what I used
to get in VS6 and in that I get "Any Apartment". I checked what the
differences might be and the only thing I found is that the .RGS file in VS6
has
ThreadingModel = s 'Both'
whereas in VS7 it doesn't exist.
Just to test my theory that it wasn't something in the code, I created empty
projects that just had the interfaces/coclasses (no code inside) below in
both VS7 and VS6 and they configure differently. That is, "Main Thread
Apartment" vs "Any Apartment"
The threading directive is the same in both cases - Here's my example in VS7
abd VS6
[
coclass,
threading("single"),
aggregatable("never"),
vi_progid("TestServer.Thetsts"),
progid("TestServer.Thetsts.1"),
version(1.0),
uuid("52E51205-5800-4C94-95F2-3C69E9937B53"),
custom(TLBATTR_TRANS_REQUIRED,0),
helpstring("Thetsts Class")
]
[
uuid(1338E2F4-7244-4948-9AE1-4A8D8BCF90C5),
TRANSACTION_REQUIRED,
helpstring("Thetsts Class")
]
coclass CThetsts
{
[default] interface IThetsts;
};
Transaction is required in both cases.
In my orginal problem, if I get the objectcontext and call setcomplete
myself, things work. I certainly don't want to go back to the MTS days where
we had to call SetComplete and SetAbort ourselves.
Could somebody please help out. I don't know if "Main Thread Apartment" and
"Any Apartment" is a red-herring or that I really have something else to add
in the code or in the RGS file.
By the way, I always I assumed that selecting "Required" caused a
transaction to be created if one did not exist and to join one if one was
already in progress. This always worked for me, but since I moved to VS7, it
doesn't seem to hold true anymore.
Also, there's nothing wrong with the stored-procedures that I'm calling
because they execute, come back with there results but once I exit, it
aborts. They work fine through the query analyzer. How I default the "vote"
to True so that it auto-commits if there's no error from the SP.
Thanks,
Julian
Julian C. Anigbogu Schlumberger Austin Product
Center
<mailto:anigbogu
slb.com> 8311 North FM 620 Road
512-331-3420(voice) Austin, Texas 78726
512-331-3320(fax) U.S.A
----------------------------------------------------------------
Users Guide http://discuss.microsoft.com/archives/mailfaq.asp
contains important info. Save time, search the archives at
http://discuss.microsoft.com/archives/index.html .
To unsubscribe, mailto:DCOM-signoff-request
DISCUSS.MICROSOFT.COM
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]