Thursday, September 25, 2008

Delphi 2009 - COM+ Custom Attributes

The COM+ tab in the Type Library editor of Delphi 2009 and C++Builder 2009 is no longer visible. The only options that did anything where the Transaction Model. If you go into the text tab (I won't suggest this very often but this is one of those times) and add one of the following custom attributes on the COM+ event object then when you register your COM+ event object in the Component Services this Transaction Model will be the default:

Transaction required:

custom('{17093CC5-9BD2-11CF-AA4F-304BF89C0001}', 0)

Requires a new transaction:

custom('{17093CC7-9BD2-11CF-AA4F-304BF89C0001}', 0)

Supports a transaction:

custom('{17093CC8-9BD2-11CF-AA4F-304BF89C0001}', 0)

Does not support a transaction:

custom('{17093CC6-9BD2-11CF-AA4F-304BF89C0001}', 0)

These custom attributes can be found in mtxattr.h. Note that the COM+ tab never worked with these two customer attributes defined in mtxattr.h:

#define TLBATTR_QUEUEABLE E5FC3761-0BBA-11d2-B8FE-00C04FC340EE
#define TLBATTR_COMTI_INTRINSICS 47065EDC-D7FE-4B03-919C-C4A50B749605

For a little history the original COM+ tab looked like this:

Everything on this page was stored by encoding the data as custom attributes in the type library. The Transaction Model used the custom attributes above which is the only useful piece of informationThe rest of the page used the custom attributes described below that only this COM+ page used so they were pointless. Note that no tools other than the this COM+ tab of the Type Library Editor and the menu item in Run | Install COM+ Objects from Delphi 7. All of the Microsoft custom attributes start with a GUID beginning with 17 while the Delphi custom attributes start with the GUID beginning with B0.

This custom attribute tells the IDE that the object is a COM+ event object and allows the COM+ tab and the Run | Install COM+ Objects menu item to be enabled:

custom('{B0FC9341-5F0E-11D3-A3B9-00C04F79AD3A}', True)

Call Synchronization where X is:

X = 0 (Ignored)
X = 1 (None)
X = 2 (Supported)
X = 3 (Required)
X = 4 (Requires New)

custom('{B0FC9344-5F0E-11D3-A3B9-00C04F79AD3A}', Value)

Creation Timeout where X is the timeout value:

custom('{B0FC9340-5F0E-11D3-A3B9-00C04F79AD3A}', X)

Allow inproc subscribers where X is True/False:

custom('{B0FC9345-5F0E-11D3-A3B9-00C04F79AD3A}', "X")

Fire in parallel where X is True/False:

custom('{B0FC9346-5F0E-11D3-A3B9-00C04F79AD3A}', "X")

Transaction Ignored:
custom('{B0FC9368-5F0E-11D3-A3B9-00C04F79AD3A}', 0)

JIT Activation:
custom('{B0FC9342-5F0E-11D3-A3B9-00C04F79AD3A}', True)

Object Pooling:
custom('{B0FC9343-5F0E-11D3-A3B9-00C04F79AD3A}' True)


Mikael Eriksson said...

The only interesting part of the COM+ page (since D7) is the Transaction Model and since the wizards allow Transaction Model to be specified there should be a way to modify that setting other then hacking the ridl file or recreate the CoClass/Interface.

This is not an issue for "COM+ Event Object".
The problem is with the "Transactional Data Modules" and with "Transactional Object".

BTW the wizards is broken so the selection you do in Transaction Model is not saved to the ridl file.



Mikael Eriksson said...

"Generate Event support code" is also broken in the "Transactional Object Wizard"



Chris Bensen said...


Thanks for the feedback. I'll bring it up with the COM team. Do you by any chance have QC entries on these issues?

Mikael Eriksson said...

Report No: 67225 Status: Reported
Transactional Object Wizard does not save Transactional Model

Report No: 67226 Status: Reported
Transactional Data Module Wizard does not save Transactional Model

Report No: 67227 Status: Reported
Transactional Object Wizard does not Generate Event support code

Report No: 67228 Status: Reported
Modify Transactional Model for Transactional Objects and Transactional Data Modules is not supported

Chris Bensen said...



Post a Comment