Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scaffolding: Make it easier to generate by-convention configuration #28641

Open
bricelam opened this issue Aug 9, 2022 · 0 comments
Open

Scaffolding: Make it easier to generate by-convention configuration #28641

bricelam opened this issue Aug 9, 2022 · 0 comments

Comments

@bricelam
Copy link
Contributor

bricelam commented Aug 9, 2022

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.

var dataAnnotations = property.GetDataAnnotations(annotationCodeGenerator)
    .Where(a => !a.IsHandledByConventions || a.Type.IsSubclassOf(typeof(ValidationAttribute));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants