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

Support custom templates #32

Open
MelGrubb opened this issue May 10, 2023 · 1 comment
Open

Support custom templates #32

MelGrubb opened this issue May 10, 2023 · 1 comment
Assignees
Labels
backlog enhancement New feature or request

Comments

@MelGrubb
Copy link
Owner

Make use of an assembly-level attribute to override higher-level items like the base class template, or to override templates on a global basis.

Consider allowing attribute parameters to override individual templates so that you could have multiple, alternative versions of certain templates, some of which get used for some classes, and some of which get used for others. I'm not sure this is as immediately useful, though. Interesting, but probably not worthwhile.

@MelGrubb
Copy link
Owner Author

MelGrubb commented Jan 14, 2024

There's a conceptual problem preventing this from moving forward. The only place to specify the version of the templates you want to use would be in the attribute. What if you tagged up different classes with different template versions? Who would win? On the surface, it seems like this would be great, you could use different templates for different classes if you wanted to, but what about the shared classes like the base class or the attribute itself? Those can only be specified once, and they will dictate the version of everything else.

For instance. C#11 allows the use of generic attributes, so we could have [BuilderFor<Foo>] instead of BuilderFor(typeof(Foo))], but that makes it incompatible with projects using previous C# versions. It might be possible to specify the template version with an assembly-level attribute. If no template is specified, then it could default to the latest version.

I'm exploring that now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backlog enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant