Skip to content

A C# implementation of the specification pattern that uses LINQKit for expression composition.

License

Notifications You must be signed in to change notification settings

joakimjm/specivacation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

A C# implementation of the specification pattern that uses LINQKit for expression composition.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages