I am developing an enterprise-like project using the DDD template. I have the following projects in my C # solution:
Domain Model - DLL Project
WebUI Project - ASP.NET MVC3
DesktopUI Project - WPF
DAL - First Entity Structure Code
Persistence - SQL Server Database
This project is small, but I try to use all the good practices of enterprise applications.
What I would like to define now is an exception strategy, but I'm not sure how to do it. I probably should use Enterprise Library log processing and locking, but I'm not sure how to do this in the picture. Some specific scenarios that I am trying to solve in my head are as follows:
If a new Entity object is created in the WPF application and the Save button is pressed, how to report errors and log in the event if an exception occurs at different levels (for example, an entity is incorrectly created according to the rule domain, or there was an error trying to save new object in the database)
The user is trying to retrieve an unknown object from the database (for example, from the WebUI by specifying the identifier of the unknown object in the URL)
I understand that I can define custom exceptions, but I'm not quite sure where and how. Should they be determined at each level? I know that there is a practice of wrap exceptions, but again, I'm not quite sure how to make the best use of this template.
(, UserAlreadyExistInDatabaseException UnknownUserDatabaseException, ) , (, DatabaseException, Exception.Message).
Entlog , . , , , , , - log4net NLog .
(WPF ASP.NET) , . , ( DDD ). , , DAL.
, , - . , UserAlreadyExistInDatabaseException, , - , , , , , .
UserAlreadyExistInDatabaseException
. , DAL, , .
. , , . , DAL - EntityNotFoundException, , . - ASP.NET MVC, , .