Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I would stay away from the EntLib exception handling and logging blocks because they are just too complex to configure and deal with in general. You can certainly explore them to see how these types of problems can be approached, but it is often easier to roll your own solution or use something like log4net or NLog for logging.</p> <p>As far as handling exceptions, the presentation layer (WPF or ASP.NET) should catch and interpret exceptions raised by the application service layer. The application service encapsulates your domain including the domain model and the data access layer (repositories in DDD speak). The application service can either return result objects which can contain error information or propagate exceptions from the domain or DAL. </p> <p>You should create custom exception types if you intend to catch them in order to do something specific with a given exception type. An exception such as <code>UserAlreadyExistInDatabaseException</code> can be helpful because the application service can catch it and return some sort of result object to be interpreted by presentation layer, or the exception can be caught in the presentation layer which would in turn inform the user.</p> <p>Logging can be done at the application service layer or the presentation layer or both. For example, an application service can catch an exception from the DAL, log it, and wrap it in another exception that the presentation layer can interpret. </p> <blockquote> <p>User tries to retrieve unknown entity from database</p> </blockquote> <p>This can be handled in several ways. One way is that the app service returns a null reference, and the presentation layer returns an appropriate message to the user. Alternatively, the DAL can raise something like EntityNotFoundException which can be caught at the presentation layer, also returning an appropriate message to the user. Raising such an exception can be beneficial with something like ASP.NET MVC because you can create an action filter which returns a generic response upon receiving an exception of said type.</p>
    singulars
    1. This table or related slice is empty.
    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.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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