The Enterprise Error Messaging System
PLEASE FOLLOW THESE INSTRUCTIONS – thanks 🙂
1 – Select the Download link below or Download the ZIP file from here
2 – If you get the prompt: “Zip is Not Commonly Download” please use Pull Down selection: “Keep” – It is Safe
3 – Locate the zip in your download folder and move to a new folder named “MessagingSystem” or a name of your choice
4 – Expand the ZIP into the newly created folder
5 – Use the Database Backup File to create the SQL 2008 Database Data Model – If it can’t be installed in your dB version, the documentation on this page can be used to create it from scratch: It is a Simple Model and all default data is detailed on this page
6 – Select the solution file: MessagingSystem.sln and open in VS2012
7 – Validate the Entity Framework App config connection string is correct for your Database
8 – Compile the solution
9 – Run the Test Runner to validate functionality of all of the components
If you have ReSharper, its test runner will appear when you open the solution. If you don’t have ReSharper you can download a free 30 day trial version. I strongly recommend doing so.
If not, the VS2102 test runner will work: Cnt +T,R,A 0r Menu – Test- Run – All Tests
The VS 2012 Solution Code for Enterprise Messaging System Demonstration
Delivering Meaningful Information
The Modern Developer understands the responsibility of Robust Error and Exception Handling.
Error handling is not just wrapping suspect code in Try/Catch Blocks. Proper handling of return result in conditional statement that implement an Error Handling Pattern is essential for proper Guarded Code.
The Solution to Class Level ‘Magic Strings’
The Core Principle: Open/Closed states:
A Class should be Open for Extension BUT Closed for Modification
If messaging within your Classes uses Strings then you have violated Open/Closed Principle.
If QA finds a misspelling or a typo you are then required to Open the Class and make the required changes. You must then recompile the Class and Close the file for the change to be enabled. This clearly violates OCP.
The Enterprise Messaging System
The Enterprise Messaging System is a SQL database three table Data Model abstracted away from the Data Layer (DL), using the Entity Framework as an Object Relational Mapping (ORM) framework to create an Anti-corruption Data Abstraction Layer (ADAL).
The Enterprise Messaging System architecture allows consumption within any Project Assembly within N-tier architecture
A Resource file solution for Messaging can be employed within Web Applications but the Universal Project Assembly Solution is a preferred Enterprise Architecture Model.
The Entity Framework Messaging System Data Model
The SQL Data Model is mapped to the Entity Context Class model as three related tables.
The Data Model Tables:
-
Components
-
MessageType
-
ComponentMessage
The Term “Component” is used because this is an Enterprise Assembly Messaging System that can Manage Error and Information Notifications across All .NET Project Types
- The Component Entity
- ComponentName – String
- Name of the Solution Assembly
- Primary Key of the Component Lookup Table
- Used as Part of the Compound Primary Key in the ComponentMessage Data Entity
- Description – String
- Information about the Component
- Primary use is for a Web Application for Management of the Messaging System to Display the Component Details
- Default Entry – “MessagingSystem”
- ComponentName – String
- ComponentMessage Entity
- MessageTag – String
- Part of the Compound Primary Key
- MessageTag
- ComponentName
- Unique Identifier for Messages within an Assembly Component
- A String Value within the Entity
- Referenced from assembly ENUMs
- ENUM creates an Intellisense List for Dynamic Reference of available messages during development
- Converted to a String for processing within the DataOps Data Layer
- Enables Global Messages within an Assembly
- Message Reuse Such as “No Records Found” Message
- Defaults
- “None” – Unit Test for Bad Parameter Sad Test
- “InactiveRecord” – Unit Test for IsActive Flag false Sad Test
- “NoRecordsFound” – Global Message
- Part of the Compound Primary Key
- ComponentName – String
- Part of the Compound Primary Key
- ComponentName
- MessageTag
- Foreign Key Unique Identifier for the Component Lookup Table
- Identifies the Assembly Component Name
- Creates a Collection for Filtering with the MessageTag
- Default Entry – “MessagingSystem”
- Part of the Compound Primary Key
- MessageTag – String
- Foreign Key Unique Identifier for the MessageType Lookup Table
- Identifies the Message Category Type
- Used for Categorization of the Messages into Types
- Default Entries
- “Information”
- “Error”
- Foreign Key Unique Identifier for the MessageType Lookup Table
- Message – String
- Actual Text Message
- Referenced by
- MessageTag
- ComponentName
- Text this is used within the Error Handling Pattern
- Referenced by
- Field for Updating Message to comply with Open/Closed Principle
- Default Entry – “No Records Found in the Messaging System Request”
- Actual Text Message
- IsActive – Boolean
- A Flag for Current Message Availability
- Defaults to true
- Set to false to prevent Message from being displayed
- An Error Message of “No Message Found” with be Returned if Flag is false
- MessageTag – String
- MessageType Entity
- Message Types – String
- Name of the Message Type
- Primary Key of the MessageType Lookup Table
- Default
- Information
- Error
- Description – String
- Information about the MessageType
- Primary use is for a Web Application for Management of the Messaging System to Display the Message Type Details
- Message Types – String
The Messaging System Class Model
The Enterprise Messaging System Class Model Defines the Relationships between the Software Entities Consumed during a Call for an Information or Error Message Type
The Messaging System Class Model represents Two Design Patterns:
-
Modern Developer Error Pattern – Client Error and Exceptions
-
Enterprise Messaging Pattern – Messages for the Error pattern
The Error Pattern creates a Base Class hierarchy for the MessageInfoResponse DTO and consists of:
-
ResponseCommon DTO – Conditional Success Flag
-
ErrorHandling Abstract Class – Behavior Methods for Error Handling
-
ErrorInfo DTO – State Object for Messages and Stack Trace Information
A Complex Composite DTO that passes the Compound Key values to the Messaging System to retrieve the requested Message using a string version of the Enum Message identifier: MessageTag.
A DTO that is available for any Solution-centric common data they may be required in the Message Request.
The default flag is a “Success” Boolean.
Creates an Intellisense list of registered Messages that are available to the Error Handling Design Pattern.
The Enum list selection is converted to a String Type and passed as a Parameter to the Messaging System via the MessageInfoRequest DTO.
A DTO that contains the Message information for a Single Message.
A Behavior Method Class that creates all the Messages for the ComponentMessageEntity Class.
All messages are created using a Static Constructor from the Entity Framework Data Context and made available to the consuming Class.
A DTO that contains the All Message information in the entire System.
This could be used for a Messing Caching System solution.
All Messages are created upon instantiation of the type.
The Primary Value Added by the Modern Developer’s Enterprise Messaging System is the Removal of “Magic Strings” within Class Error Handling Routines.
This Process Complies with the Open/Closed in the Core Design Principles
An additional Value Add is the ENUM List of Registered Messages that easily enables the reuse of Common Messages and act as an Intellisense List of Available Messages for the Developer to consume.
Latest posts by Brad Huett (see all)
- DevOps: A Bridge to Your DevOps Culture - March 25, 2016
- Embracing Test Driven Development (TDD) - March 25, 2016
- DevOps: Delivering Agile Projects - March 25, 2016