Scaffolding: Make it easier to generate by-convention configuration
- Dominant language
- C#
- Stars
- 14.8k
- Forks
- 3.4k
- PR merge metrics
- PR metrics pending
Description
Today, the `GetFluentApiCalls` and `GetDataAnnotations` extensions used by the templates automatically filter out configurations that will be handled by conventions. It would be nice if the user could still choose to include these in the generated code.
I imagine that we'd add a property like `IsHandledByConventions` to the returned objects. And just filter them back out in the templates.
Then if users want, for example, to always include validation attributes (#9580), the templates could include code like this.
```c#
var dataAnnotations = property.GetDataAnnotations(annotationCodeGenerator)
.Where(a => !a.IsHandledByConventions || a.Type.IsSubclassOf(typeof(ValidationAttribute));
```
Contributor guide
Assessment
This issue has not been assessed yet.