-
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Refactor code templates processing, move more to compiled #33
Conversation
4ee20c2
to
91deeaf
Compare
🧪 Details on macOS Unix 14.7.1✅ StructId.CodeTemplateTests.AddsStructIdNamespace 🧪 Details on Ubuntu 22.04.5 LTS✅ StructId.CodeTemplateTests.AddsStructIdNamespace 🧪 Details on Microsoft Windows 10.0.20348✅ StructId.CodeTemplateTests.AddsStructIdNamespace from dotnet-retest v0.6.3 on .NET 8.0.11 with 💜 |
Refactor resource and compiled templates to use a unified CodeTemplate implementation that simplifies the application of a template for a given target struct id. This allowed to also simplify quite a bit the tests. Most templates are now simple compiled ones, except for the ones that need custom logic that isn't just checking target value type (TId) compatiblity. In particular: ctor generation is dynamic since users can provide their own ctor, so we can't just apply them as compiled templates. EF, Dapper and Newtonsoft.Json need conditional checking on type presense, so they cannot be ported either. Regardless, we now have a single unified way of authoring templates for either scenario. This infolves using always file-only types, which removes cross-template dependencies we had with a hardcoded TSelf/TId pair.
Refactor resource and compiled templates to use a unified CodeTemplate implementation that simplifies the application of a template for a given target struct id.
This allowed to also simplify quite a bit the tests.
Most templates are now simple compiled ones, except for the ones that need custom logic that isn't just checking target value type (TId) compatiblity.
In particular: ctor generation is dynamic since users can provide their own ctor, so we can't just apply them as compiled templates.
EF, Dapper and Newtonsoft.Json need conditional checking on type presense, so they cannot be ported either.
Regardless, we now have a single unified way of authoring templates for either scenario. This infolves using always file-only types, which removes cross-template dependencies we had with a hardcoded TSelf/TId pair.