.NETGURU
Newbie question -on enablecommit and disablecommit
Messages   Related Types
This message was discovered on microsoft.public.dotnet.framework.component_services.

Post a new message to this list...

sidd
Hi All,
1)enableCommit Sets the consistent bit to true and the done bit to
false in the COM+ context.

but could some one explain a senario(example) when one would use this
method.

in other words an example on when one would want to sets the
consistent bit to true and the done bit to false .

i could see the description for these methods in msdn but could not
find a sample which would explain when and where to use it .
if possible please explain in follwoing cases
i)objects are only making use of com+ transaction support
ii)objects are using JITA and/or object pooling.

2)also second question ..if you are using com+ transaction support,can
one also use transaction in storedProc level.commiting or rollbacking
a transaction in stored proc... will it have any effect?

thanks
siddharth
Reply to this message...
 
    
Michael D. Long
You would use EnableCommit when a client needs to make 2 or more calls into
the same instance of the object. This obviously doesn't work in a purely
stateless design. Before employing such an approach, carefully consider the
rather nasty side effects that will (not may, but will) occur under load due
to the indeterminate latency of the client application and associated
network I/O.

As to transaction management, when developing stored procedures that may be
called from an object participating in a distributed transaction you should
always check the @@TRANCOUNT value. A fairly common practice is to perform
manual transaction management within the stored proc only when this value is
0 upon entry.

Example:

SET @tc = @@TRANCOUNT
IF @tc = 0 BEGIN
BEGIN TRAN
END

-- cleanup processing
IF @tc = 0 AND @@TRANCOUNT > 0 BEGIN
IF @errcnt = 0 BEGIN
COMMIT TRAN
END
ELSE BEGIN
ROLLBACK TRAN
END
END

A ROLLBACK TRAN in the stored proc would have the effect of a SetAbort.
Also, calls to BEGIN TRAN and COMMIT TRAN within the stored procedure are
effectively ignored.

--
Michael D. Long
Microsoft MVP - Windows SDK

"sidd" <Click here to reveal e-mail address> wrote in message
news:Click here to reveal e-mail address...
[Original message clipped]

Reply to this message...
 
    
sidd
thanks Michael
-siddharth
Reply to this message...
 
 




ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
Ad


Need Dot Net Interview Questions?
Ask ExamGuru, Inc. for advice and help on Passing .Net Interviews
.Net Projects
Best-of-breed application framework for .NET projects, developed by ExamGuru, Inc. and ExamGuru IT
Free .net Help
Commission ExamGuru, Inc. and his team for your next bespoke software project
FogBUGZ
The only bug tracking system carefully crafted with one goal in mind: helping teams create great software.
Awesome Tools
If you don't know about these, you're missing out... IT Certification Questions
IT Interview Questions
Free Oracle 10g Training
MCSE Boortcamp
Cisco Study Guides
Cheap Study Guides
Exact Questions
Dot Net Interview Questions
Oracle OCP
Cheap Travel
Designer Perfumes - Wholesale Prices
Free Programming Tutorials
 
ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
 Copyright © ExamGuru, Inc. 2001-2006
Contact Us - Terms of Use - Privacy Policy - www.dot-net-guru.com - www.examguru.net - www.oraclesource.net - www.itinterviews.net - www.examguru.net/ITCertification