[Transactional] Attribute on Parent and Child?

[Transactional] Attribute on Parent and Child?

Old forum URL: forums.lhotka.net/forums/t/6819.aspx


raz0rf1sh posted on Saturday, April 18, 2009

I am looking at my code and I notice I have the following attribute around my DataPortal_Insert methods:

[Transactional(TransactionalTypes.TransactionScope)]

I notice that on SOME of my child objects, I have the same attribute on the Child_Insert and Child_Update methods.

My question is, because my children seem to work with our without the attribute, is what is the proper way? I find it odd that it works both ways ... could be from a lack of understanding on my part.

Also, is it necessary... or beneficial to have the same attribute wrap a Fetch?

Thanks in advance!

ajj3085 replied on Monday, April 20, 2009

That attribute won't have any effect on Child_xyz methods... only the DataPortal_XYZ methods will honor it.

Fetches don't usually need transactions, as I think by default you won't read dirty data. So as long as you haven't changed your locking type, I'd think it'd be fine.

raz0rf1sh replied on Monday, April 20, 2009

Thank you! That explains it!

Copyright (c) Marimer LLC