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: CHANGELOG.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,6 +17,7 @@
17
17
-`c-datetime-picker`: Assorted UI and UX improvements and fixes.
18
18
-`c-display` now auto-refreshes date distance formatting (`format: { distance: true }`) using an adaptive refresh interval based on the displayed distance.
19
19
- Added `headerComment` generator configuration option to emit custom comments at the start of all generated files. Supports cascading hierarchical configuration—define on a parent generator and child generators automatically inherit the value.
20
+
- Added `SearchAttribute.Includes` and `SearchAttribute.Excludes` to scope search participation by the request `includes` value in `ApplyListSearchTerm`.
20
21
-`[DefaultOrderBy(Suppress = true)]` can now be placed on a collection navigation property to suppress the default sorting of that collection in the generated response DTO.
The default value (i.e. no action) is the empty string.
25
25
26
+
## SearchAttribute Includes/Excludes
27
+
28
+
`includes` is also used by [`[Search]`](/modeling/model-components/attributes/search.md) when you set `SearchAttribute.Includes` or `SearchAttribute.Excludes`.
29
+
30
+
-`Search(Includes = "...")`: property is searchable only when the request `includes` string matches.
31
+
-`Search(Excludes = "...")`: property is not searchable when the request `includes` string matches.
32
+
33
+
Example:
34
+
35
+
```cs
36
+
[Search(Includes="details")]
37
+
publicstringBiography { get; set; }
38
+
```
39
+
40
+
With the above, `Biography` participates in list searching only when the request has `?includes=details`.
41
+
26
42
### Special Values
27
43
28
44
There are a few values of `includes` that are either set by default in the auto-generated views, or otherwise have special meaning:
Copy file name to clipboardExpand all lines: docs/modeling/model-components/attributes/search.md
+31-1Lines changed: 31 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,6 +11,8 @@ By default, the system will search any field with the name 'Name'. If this doesn
11
11
12
12
Searching will not search on properties that are hidden from the user by [Security Attributes](./security-attribute.md).
13
13
14
+
`[Search(Includes = ...)]` and `[Search(Excludes = ...)]` use the request's `includes` value. For background on `includes`, see [Includes String](/concepts/includes.md).
A comma-delimited list of model class names that, if set, will prevent the targeted property from being searched if the root object of the API call was one of the specified class names.
108
+
A comma-delimited list of model class names that, if set, will prevent the targeted property from being searched if the root object of the API call was one of the specified class names.
109
+
110
+
<Propdef="public string Includes { get; set; } = null;" />
111
+
112
+
A comma-delimited list of content views that, if set, will restrict the targeted property from being searched unless the request includes one of the specified content views.
113
+
114
+
When this property is set, the property will only be searched if the API request includes a matching value in the `includes` parameter. If this is empty or null, the property is searched regardless of content view.
115
+
116
+
For example, if a property has `[Search(Includes = "details")]`, it will only be searched when the request includes `?includes=details`. Multiple values can be specified as a comma-delimited list: `Includes = "details, admin"`.
A comma-delimited list of content views that, if set, will restrict the targeted property from being searched if the request includes one of the specified content views.
121
+
122
+
When this property is set, the property will not be searched if the API request includes a matching value in the `includes` parameter. If this is empty or null, the property is searched regardless of content view.
123
+
124
+
For example, if a property has `[Search(Excludes = "preview")]`, it will not be searched when the request includes `?includes=preview`. Multiple values can be specified as a comma-delimited list: `Excludes = "preview, summary"`.
125
+
126
+
If both `Includes` and `Excludes` are specified, `Includes` takes precedence.
0 commit comments