PDA

View Full Version : Problem setting TransactionAttribute to other than default



hakangranstedt
04-27-2007, 09:17 AM
I have a problem setting the System.EnterpriseServices.TransactionAttribute to another value than the default (Required). There are two ctor's for TransactionAttribute, one that defaults to Required and one that takes System.EnterpriseServices.TransactionOption as parameter. The TransactionAttribute has a Value property but that is read only so I have to use the ctor like this:


<object id="MyComponent" type="Spring.EnterpriseServices.ServicedComponentExporte r, Spring.Services">
<property name="TargetName" value="MyService" />
<property name="TypeAttributes">
<list>
<object type="System.EnterpriseServices.TransactionAttribute, System.EnterpriseServices" >
<constructor-arg index="0" value="RequiresNew" />
</object>
</list>
</property>
<property name="MemberAttributes">
<dictionary>
<entry key="*">
<list>
<object type="System.EnterpriseServices.AutoCompleteAttribute, System.EnterpriseServices" />
</list>
</entry>
</dictionary>
</property>
</object>

I have tried to debug to see where the problem is but I'm not the man to solve this. Maybe this could be a hint for you that are more familiar with the Spring framework:
In ReflectionUtils.cs - public static CustomAttributeBuilder CreateCustomAttribute(Type type, object[] ctorArgs, Attribute sourceAttribute) doesn't take care of other ctor's than those without parameters, is this correct or is something missing?

Is this understandable at all??

Bruno Baia
04-30-2007, 12:24 PM
Hi,

There is a problem with TransactionAttribute, you can set TransactionOption only using the constructor, there is no property setter.
I've got this problem with others attributes too, and implemented another solution in WebServiceProxyFactory.
I'll send a message to the springnet-developer mailing list about that.

Anyway, I implemented a temporary fix in ServiceComponentExporter and will be available in the next nightly build.


- Bruno