Note that there are some explanatory texts on larger screens.

plurals
  1. POWCF Exception handling with batch operations
    primarykey
    data
    text
    <p>I need an hint on this architectural problem.</p> <p>My application calls different wcf services that perform specific tasks returning a list of model objects.</p> <p>Say, I have a service which polls stock exchange titles returning a <code>List&lt;SeTitle&gt;</code>. [Purely fictional example, I'm reading a book on this subject]</p> <p>If an exception happens in one or few elements of this list I have two options in the wcf service: </p> <ul> <li>catch the exception, log it and return the List&lt;>, but in this way I'll lose evidence of all the faulty items in my application.</li> <li>throw an exception on first error, but in this way I won't receive any info even if only one item was "faulty".</li> </ul> <p>My will is to go for a third option, meaning that I'll always return my List but with the evidence of faulty items.</p> <p>My idea is to let all my model object extend a simple interface like (pardon names, they are horrible)</p> <pre><code>public interface IWcfReturnObject { public List&lt;WarningModel&gt; Warnings; } </code></pre> <p>and </p> <pre><code>public class SeTitle : IWcfReturnObject </code></pre> <p>in a such a way each element of the list could have an associated List of Warnings/Error to be returned to the application and then to the interface.</p> <p>My questions are:</p> <ul> <li>Is my question clear to understand?! ;)</li> <li>Do you think my desire (receive all element from wcf with warnings attached) is architecturally good?</li> <li>Do you think it exists a better approach to solve this problem?</li> </ul> <p>Thanks</p> <p>M.</p> <p>EDIT: I was doing research and looking at the first answer I think it is useful to give one solution I found on the NET</p> <p>Possible Solutions</p> <ol> <li>My way</li> <li>Log with some kind of correlation and refer it on the business layer as decyclone suggested</li> <li><a href="http://jclaes.blogspot.com/2010/05/exception-handling-in-batch-operations.html" rel="nofollow">AggregateException</a> </li> </ol>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload