You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/extensions/extend-define-evaluators.md
+56-1Lines changed: 56 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,4 +5,59 @@ parent: Extensions
5
5
nav_order: 3
6
6
---
7
7
8
-
How to extend or define your own evaluators
8
+
How to extend or define your own evaluators.
9
+
10
+
## Evaluators
11
+
12
+
Evaluators are used within the specification to compose the query that will be executed. You can add your own evaluators to extend the behavior of the base Specification class.
Copy file name to clipboardExpand all lines: docs/extensions/extend-specification-builder.md
+1-2Lines changed: 1 addition & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,6 @@ parent: Extensions
5
5
nav_order: 2
6
6
---
7
7
8
-
9
8
# How to add extensions to the specification builder
10
9
11
10
The specification builder from `Ardalis.Specification` is extensible by design. In fact, the methods you can use out of the box are implemented as extension methods themselves (check out the [source code](https://github.com/ardalis/Specification/blob/main/Specification/src/Ardalis.Specification/Builder/SpecificationBuilderExtensions.cs)). Your project might have requirements that cannot be satisfied by the existing toolset of course, or you might want to simplify repetitive code in several specification constructors. Whatever your case, enhancing the default builder is easy by creating your own extension methods.
@@ -20,7 +19,7 @@ Query.AsNoTracking()
20
19
From here you can inspect the return type of the builder method you chained it to (`AsNoTracking`), and create an extension method on that interface (it doesn't need to be chained of course -- working on `Query` itself is also valid). This will most likely be `ISpecificationBuilder<T>`, but in some cases it's an inherited inteface. The example below illustrates how extension methods on inherited interfaces allow the builder to offer specific methods in specific contexts.
21
20
22
21
23
-
## Example: Configure caching behaviour through specification builder extension method
22
+
## Example: Configure caching behavior through specification builder extension method
24
23
25
24
In order to achieve this (note the `.WithTimeToLive` method):
Copy file name to clipboardExpand all lines: docs/usage/create-specifications.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -39,10 +39,10 @@ public class ItemByIdSpec : Specification<Item>
39
39
}
40
40
```
41
41
42
-
Finally: the Specification above should also implement the marker interface `ISingleResultSpecification`, which makes clear that this Specification will return only one result. Any "ById" Specification, and any other Specification intended to return only one result, should implement this interface to make clear that it returns a single result.
42
+
Finally: the Specification above should also implement the marker interface `ISingleResultSpecification<T>`, which makes clear that this Specification will return only one result. Any "ById" Specification, and any other Specification intended to return only one result, should implement this interface to make clear that it returns a single result.
0 commit comments