Allows business rules to be recombined by chaining the business rules together using boolean logic. The pattern is frequently used in the context of domain-driven design.
Questions tagged [specification-pattern]
114 questions
2
votes
1 answer
.ThenInclude in Specification Pattern , EF Core
Can anybody please guide me, how to add .ThenInclude(s) in Specification pattern ; i am using Entity framework Core.
I have below code for .Include, which is working.
public interface ISpecification
{
Expression> Criteria { get;…

Babar Zulfiqar
- 83
- 5
2
votes
2 answers
How can I use OrderBy with an aggregate of a object property with Ardalis Specification?
I am trying to query my postgresql database using Ef core and Ardalis Specification.
For the query I build I want to sort the results by using OrderBy with an aggregate of a property that is on a nested object.
The sorting I want is to sort the list…
user5283666
2
votes
1 answer
mvvm repository filtering
I have some master-detail classes based in large part on Josh Smith's msdn article. Its great code, especially for an example, but leaves me wondering how best to handle situations where you want some subset of a repository.
So Josh has a class…

Berryl
- 12,471
- 22
- 98
- 182
2
votes
0 answers
Swagger not detecting params from runtime
I'm using this lib https://github.com/tkaczmarzyk/specification-arg-resolver to generate specifications in Spring Boot. The problem is this lib is generating them in run time whereas swagger works in compile time. Swagger detects only params used in…

Shocter
- 21
- 2
2
votes
3 answers
how can a find a patter of numbers in consecutive lines with python?
Im learning python but i have some problems with my scripts yet.
I have a file similar to:
1 5
2 5
3 5
4 2
5 1
6 7
7 7
8 8
I want to print the pairs of numbers 2-1 in consecutive lines, just taking the column 2 to find them, and then, print the…

Hdez
- 151
- 7
2
votes
1 answer
Adding paging and filtering to typical Linq Specification pattern?
I have an ASP.NET MVC2 app that has heavy use of grids. I'd like to see if there is a way to add efficient paging and filtering to the typical Specification pattern.
Basically, the call that starts it all looks like…

alphadogg
- 12,762
- 9
- 54
- 88
2
votes
2 answers
Is Specification pattern for EF entities or Domain Objects
I am new to Domain driven design, so please excuse me if this question is trivial. I was reading about specification pattern and I believe understood its intent. Most of examples on web, shows its usage at two places:
Inside repository method…

Pragmatic
- 3,093
- 4
- 33
- 62
2
votes
1 answer
Trouble Creating Specification Across Entities With NLinq
I am using the Specification pattern, and have a working implementation (taken from the WhoCanHelpMe Codeplex project) for getting data via NLinq, generic repositories and all that goodness.
The root method is:
public IList…

alphadogg
- 12,762
- 9
- 54
- 88
2
votes
2 answers
Specification pattern - creating compound specifications using lambdas (C#)
If I have a specification defined as an Expression as below:
public Expression> IsSuperhuman =
x => x.CanFly && x.HasXRayVision;
And I want to define another specification 'IsSuperheroine' with the logic 'is superhuman and is…

David
- 15,750
- 22
- 90
- 150
2
votes
1 answer
Specification Pattern and Boolean Operator Precedence
In our project, we have implemented the Specification Pattern with boolean operators (see DDD p 274), like so:
public abstract class Rule {
public Rule and(Rule rule) {
return new AndRule(this, rule);
}
public Rule or(Rule…

Anders Nielsen
- 23
- 2
2
votes
3 answers
Using the Specification Pattern
Like any design pattern the Specification Pattern is a great concept but susceptible to overuse by an eager architect/developer.
I am about to commence development on a new application (.NET & C#) and really like the concept of the Specification…

Kane
- 16,471
- 11
- 61
- 86
2
votes
4 answers
How to adapt the Specification pattern to evaluate a combination of objects?
I know that the Specification pattern describes how to use a hierarchy of classes implementing ISpecification to evaluate if a candidate object of type T matches a certain specification (= satisfies a business rule).
My problem : the business…

ONETHRD
- 21
- 1
- 3
2
votes
1 answer
How to combine conditions dynamically?
This question is an enhancement to the already answered question How to apply multiple filter conditions (simultaneously) on a list?
In the above mentioned question we have a method that applied AND operator on all the specifications. This is…

LCJ
- 22,196
- 67
- 260
- 418
2
votes
1 answer
How to use a specification pattern for my requirements?
I have read some examples of the specification pattern, but it is hard to get idea how to implement with this pattern.
I am developing a huge program for a client. I need to import XML files from a specific bank, then do validation with each of…

user1358072
- 447
- 2
- 12
- 26
2
votes
1 answer
Specification Pattern Modified (Candidate In Constructor)
I know that design patterns are set by the design and not by specific code yet sometimes I get concerned that I bent the pattern too much and no longer follow the design.
For Example Specification Pattern looks like this:
public interface…

Andrej K
- 1,794
- 1
- 17
- 37