LOB application case study: applying what we have learned
The last step for this chapter is to extend our sample application with some error handling mechanisms. We will use the following approach:
Server side
At the server side, a new table is introduced where we store all the messages. Whenever a new exception is raised, we query if such a record already exists in the database. If not, we generate and fill a new entity. We also use a category value, which identifies if it is a server-side or client-side error.
private static int StoreError(ErrorItem errorItem, int category) { int errorCode = -1; using (BookingsEntities entities = new BookingsEntities()) { // Query if a record exists. Error error = QueryErrorItem(errorItem, category, entities); if (error == null) { // If no record exists, // create new one. AddErrorItem(errorItem, category, entities); } // Combine the category with error id to // create the error code. errorCode...