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Ū  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