Skip to content

Latest commit

 

History

History
32 lines (16 loc) · 2.32 KB

README.md

File metadata and controls

32 lines (16 loc) · 2.32 KB

MyGet Build Status

SpeciVacation

Because the specification pattern is a pretty helpful tool in the struggle to keep code bases maintainable.

Installation

Package is available on NuGet.

dotnet add package SpeciVacation

or

Install-Package SpeciVacation

But why?

Composing specifications should be easy and just work no matter the database technology. This requires some work with the underlying C# Expression.

I am not a smart man, and working with Expressions feels to me like building a sandcastle with dry sand. There are many guides and good ideas on stackoverflow and elsewhere, that look like they should work, but then they don't. This is where LINQKit comes into the picture and alleviates all the Expression-headaches. It's built for Entity Framework but also seems to just work with the MongoDB drivers.

Granted, other implementations of the specification pattern already exist. However:

I feel the "new way" of NSpecifications a step in the wrong direction for maintainability because it's use of a generic specification implementation.

SpecificationPattern (another open source piece of code) is only implemented through an abstract class, and I've had use cases where I like having the interface available to encapsulate the same business rule for multiple entity types. More importantly the way expressions are composed just don't work with MongoDB, which I use extensively. This is where LINQKit comes into the picture. Now my only problem is which operations are supported by the Mongo driver :-x

The name

The name NuGet package id Specification was already in use and I found it pretty punny because I was on vacation when I set up the repository and the MyGet CI.