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

Create a Models Incremental Generator #227

Open
efonsecab opened this issue Nov 16, 2024 · 0 comments
Open

Create a Models Incremental Generator #227

efonsecab opened this issue Nov 16, 2024 · 0 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@efonsecab
Copy link
Contributor

efonsecab commented Nov 16, 2024

There are many cases in which we can avoid writing lots of manual code for models, this can be done following a similar approach to the one already used for many services, which uses Incremental Generators.
The models project, however, has some special considerations, first, it must identify which models to generate and which not, that can be done by using the already used approach of having a Custom Attribute.
The generator must read the Model.xml file generated by the database project, this file contains the definition of the tables, however, using IO from analyzers while possible, is discouraged, and will even cause a compilation error unless the warnings are suppressed, we do not want to do that.
We need to identify a way in which we can use generators to implement this functionality, the models should end up being something like this

[GenerateModel("dbo.MyTable")]
public partial class MyTable
{
}

Existent services generator: https://github.com/pticostaricags/FairPlayCombined/blob/main/src/FairPlayCombinedSln/FairPlayCombined.Services.Generators/ServiceOfTGenerator.cs

@efonsecab efonsecab added enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed and removed good first issue Good for newcomers labels Nov 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant