Specification Pattern with C#

Reading Time: 6 minutes

What is specification pattern?

Specification pattern is a software designing pattern where business logic is maintained in single unit which can then be used to either validate business logic against domain model or can be used to chain business rules together using Boolean logic operands like AND,OR,NOT to retrieve expected results.

In this article, we will discuss about specification pattern. We will cover brief overview of specification pattern, its use in domain-driven development and its usefulness to keep DRY (Don’t Repeat Yourself) principle intact while implementing business logic. We will also discuss implementation of specification pattern together with repository pattern and c#’s generics to obtain generic abstract specification which will provide base of pattern.