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/09_GenerateDtosAttribute.md
+42-11Lines changed: 42 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# GenerateDtos Attribute Reference
2
2
3
-
The `[GenerateDtos]`and `[GenerateAuditableDtos]` attributes automatically generate standard CRUD DTOs (Create, Update, Response, Query, Upsert, Patch) for domain models, eliminating the need to manually write repetitive DTO classes.
3
+
The `[GenerateDtos]`attribute automatically generates standard CRUD DTOs (Create, Update, Response, Query, Upsert, Patch) for domain models, eliminating the need to manually write repetitive DTO classes.
4
4
5
5
## GenerateDtos Attribute
6
6
@@ -27,6 +27,7 @@ public class User
27
27
|`OutputType`|`OutputType`| The output type for generated DTOs (default: Record). |
28
28
|`Namespace`|`string?`| Custom namespace for generated DTOs (default: same as source type). |
29
29
|`ExcludeProperties`|`string[]`| Properties to exclude from all generated DTOs. |
30
+
|`ExcludeAuditFields`|`bool`| Automatically exclude common audit fields (default: false). See [Excluding Audit Fields](#excluding-audit-fields). |
30
31
|`Prefix`|`string?`| Custom prefix for generated DTO names. |
31
32
|`Suffix`|`string?`| Custom suffix for generated DTO names. |
32
33
|`IncludeFields`|`bool`| Include public fields from the source type (default: false). |
@@ -56,32 +57,62 @@ public class User
56
57
|`Struct`| Generate as structs |
57
58
|`RecordStruct`| Generate as record structs |
58
59
59
-
## GenerateAuditableDtos Attribute
60
+
## Excluding Audit Fields
60
61
61
-
A specialized version of `GenerateDtos` that automatically excludes common audit fields: `CreatedDate`, `UpdatedDate`, `CreatedAt`, `UpdatedAt`, `CreatedBy`, `UpdatedBy`.
62
+
Use the `ExcludeAuditFields` property to automatically exclude common audit/tracking fields from the generated DTOs.
63
+
64
+
When `ExcludeAuditFields = true`, the following fields are automatically excluded:
publicstringInternalNotes { get; set; } // Will be excluded
95
+
publicstringSecretKey { get; set; } // Will be excluded
96
+
publicDateTimeCreatedAt { get; set; } // Will be excluded (audit field)
97
+
}
98
+
```
99
+
100
+
## Obsolete: GenerateAuditableDtos Attribute
79
101
80
-
Same as `GenerateDtos` with the addition of automatic exclusion of audit fields.
102
+
> **?? Deprecated:** The `[GenerateAuditableDtos]` attribute has been replaced by `[GenerateDtos]` with `ExcludeAuditFields = true`. The old attribute will be removed in a future version.
0 commit comments