My view on Autocomplete is that it is fine if you do not need more
fine-grained control.  What's more: every system I have worked on had a
longer life than expected and invariably you will need more fine grained
control, so I stay away from autocomplete and rather use
setcomplete/setabort.  With control comes responsibility however.

Using setcomplete/setabort, you can catch and handle you custom exceptions
and do transaction rollback on all other errors with ease.



JC Oberholzer

Visit us at www.sdt.co.za



-----Original Message-----
From: Bill Bassler [mailto:[EMAIL PROTECTED]
Sent: Tuesday, November 11, 2003 10:26 PM
To: [EMAIL PROTECTED]
Subject: [ADVANCED-DOTNET] Serviced Component, distributed transactions and
Custom Exceptions

This is a general application architecture question.

Scenario:

I have several .Net components working together to form an application.
These components are serviced because the objects represented inside of
them work together to create and update the data that define the object
across multiple calls to the database. In this way, if I have problem
anywhere across all the calls all insert or update action is rolledback.
I'm currently using the [AutoComplete] attribute to decorate the methods
so that the work is committed and the objects are JITA deactivated at the
completion of the method.

I also have retrieval methods to hydrate the objects from the data inserted
or updated from the methods described above.

I have custom exceptions (inheriting from ApplicationException) that define
exceptions such as "ItemNotFound" or "ItemDoesNotExist".

I typically use these exceptions to abort processing and return the
exception to the caller within the components. For example:

if (sessionTransactionDataSet.Tables["sessionTransaction"].Rows.Count == 0)
    throw new TransactionNotFoundException
("Session Transaction not found for Transaction ID: " + transactionId
+ ".");

As you can see, these exceptions don't always define a catastrophic/fatal
error such as divide by zero error.


If I have an method that does retrieval to hydrate the objects from the
data inserted or updated from the methods described above and that method
or a method called within that method's call throw an exception and that
method is marked [AutoComplete] of course I get rollback of the entire
transaaction.

Question
What is the best application strategy to use. Should I not use custom
errors for the purpose described abbove or there a way to negate the
exception if I wish and have the higher-level transaction complete if I
want it to?

===================================
This list is hosted by DevelopMentor(r)  http://www.develop.com
Some .NET courses you may be interested in:

Guerrilla ASP.NET, 10 Nov 2003 in London and 26 Jan 2004, in Los Angeles
http://www.develop.com/courses/gaspdotnet

Guerrilla .NET, 8 Dec 2003, in Los Angeles
http://www.develop.com/courses/gdotnet

View archives and manage your subscription(s) at http://discuss.develop.com

The views expressed in this e-mail are, unless otherwise stated, those of the author 
and not of SDT or its management. The information is confidential and is intended 
solely for the addressee. All reasonable steps are taken to ensure the accuracy, 
integrity and confidentiality of information. No liability or responsibility is 
accepted if information is corrupted or does not reach its intended destination. This 
email message has been scanned for viruses and cleared.

===================================
This list is hosted by DevelopMentorŪ  http://www.develop.com
Some .NET courses you may be interested in:

Guerrilla ASP.NET, 10 Nov 2003 in London and 26 Jan 2004, in Los Angeles
http://www.develop.com/courses/gaspdotnet

Guerrilla .NET, 8 Dec 2003, in Los Angeles
http://www.develop.com/courses/gdotnet

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to