Assignment for MOM
#Design Patterns
1. Repository Pattern
Why Repository Pattern ?
it provides an abstraction of data, so that our application can work with a simple abstraction that has an interface approximating that of a collection. Data processing (CURD) (for us fetch data from WebAPI) from this collection is done through a straightforward method. Using this pattern can help achieve loose coupling and can keep domain objects persistence ignorant.
- A data persistence abstraction
- Business logic can be tested without need for an external source ( in my code WebDataService, BusinessService)
- Database access logic can be tested separately (in my code WebDataRepository)
- No duplication of code
- Domain driven development is easier
- Centralizing the data access logic, so code maintainability is easier
2. Dependency Injection Pattern
Why Dependency Injection ?
Dependency Injection (DI) is an object-oriented programming design pattern that allows us to develop loosely coupled code.
DI helps in getting rid of tightly coupled software components.
The purpose of DI is to make code maintainable and easy to update.
DI is a technique to create a dependency or dependencies outside the class that uses it.
The dependencies are injected from the code that calls the class and any information about their creation are kept away from the inside of the class
(In my code I have used constructor injection in WebDataService)
1. Download the MOM_Assignment repository
2. Open in visul studio version 2017
3. Build the solution in release/debug mode
1. Open command prompt
2. Go to folder bin folder where .exe resides(debug or Release) (path-> MOM_Assignment\MOM_Assignment\MOM_Assignment\bin\Release , MOM_Assignment\MOM_Assignment\MOM_Assignment\bin\Debug)
3. Run exe in command line (Command -> MOM_Assignment Jan-2018 Dec-2018)
Note : Run command prompt in full screen mode to view best result because of console application.
Required Nuget Pakage Newtonsoft.Json 12.0.1
Required Nuget Pakage MarkdownLog 0.9.3