ardalis / ardalis/Specification

How to use multiple specs in another

Open
#543 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
2.3k
Forks
262
PR merge metrics
No merged PRs in 30d

Description

Hello

I try to use multiple specs in another, to create a complex spec. Is it possible ?

Thanks :)

``` C#
public class DuplicateExpenseSpecification : Specification
{
public DuplicateExpenseSpecification(Expense expense)
{
ISpecification expenseWithAmountSpecification = new ExpenseWithAmountSpecification(expense.Amount);
ISpecification expenseWithCurrencySpecification = new ExpenseWithCurrencySpecification(expense.Currency);
ISpecification expenseWithUserIdSpecification = new ExpenseWithUserIdSpecification(expense.UserId);

// this.Query...
}
}
```

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the Specification and ISpecification types shown in the example, then inspect how existing specifications are composed in the repository. Clarify whether the desired result is supported composition or documentation of an existing pattern; done should include a documented or tested answer for combining the three Expense specifications.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.