You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
{
}
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
Existent services generator: https://github.com/pticostaricags/FairPlayCombined/blob/main/src/FairPlayCombinedSln/FairPlayCombined.Services.Generators/ServiceOfTGenerator.cs
The text was updated successfully, but these errors were encountered: