Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

VB.NET, COM+, CRM's, and two phase commit

Posted on 2004-11-23
6
Medium Priority
?
448 Views
Last Modified: 2008-02-01
I want to add transactional functionality to an automated extract file loader I am building.  I have built CRM's for the FileSystem, and I believe that SQL and DTS already support this.  To add my service to COM+, is it as simple as saying TransactionOption.Required at the top of the class?  If I call multiple CRM's in the class, are they all convered under the Transaction?  For instance, if I move a file via a FSO CRM, and update the database through the DTS Com interop object, and then call ContextUtil.Abort, will both rollback?
0
Comment
Question by:platinumbay
  • 3
  • 3
6 Comments
 
LVL 16

Accepted Solution

by:
muzzy2003 earned 1500 total points
ID: 12680388
You need to inherit your class from System.EnterpriseServices.ServicedComponent as well. Then I normally place Transaction(TransactionOption.Required) as an attribute at the top of the class, and I generally specify the COM+ application details in the AssemblyInfo file as:

[assembly: ApplicationName("<<app name>>")]
[assembly: ApplicationID("<<app guid>>")]

Personally, I find the quickest way to generate a GUID to use is SELECT NEWID() in SQL Server, but there are other methods of course. Both the class files and the AssemblyInfo file will need a reference:

Imports System.EnterpriseServices

You might also want to check out the AutoCopmleteAttribute class - you can flag your methods with the [AutoComplete] attribute to have them automatically determine transaction outcome based on the detection of any errors.

In answer to your question about both rolling back, it rather depends on how good your CRM is for the FileSystem. In theory, yes. I'd suggest trying it and seeing.
0
 
LVL 6

Author Comment

by:platinumbay
ID: 12682010
Does application name point to the Application I am build, or a COM+ application?  Do I need to pre-create the COM+ application first?  Should the GUID point to the GUID of the COM+ application?
0
 
LVL 16

Expert Comment

by:muzzy2003
ID: 12682039
Name and GUID are for the COM+ application. You don't need to pre-create it.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 6

Author Comment

by:platinumbay
ID: 12682047
Sweet!  Last question.  Being in COM+ using CMRs and having the Transaction attributes in the code, is it true XA compliance?
0
 
LVL 16

Expert Comment

by:muzzy2003
ID: 12682182
Never looked into compliance - don't know.
0
 
LVL 6

Author Comment

by:platinumbay
ID: 12682345
Post your first response to the other question to get your points.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Kernel Data Recovery is a renowned Data Recovery solution provider which offers wide range of softwares for both enterprise and home users with its cost-effective solutions. Let's have a quick overview of the journey and data recovery tools range he…
Suggested Courses

564 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question