More than100 examples of RSCG
I am deeply into Roslyn Source Code Generators. I like when code generates code . So I have created ones and make inventory of others . You can find the examples here by date : https://ignatandrei.github.io/RSCG_Examples/v2/docs/List-of-RSCG and by category https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples
I have started when they appeared, with ISourceGenerator and now I am fond , even if the interface
IIncrementalGenerator https://learn.microsoft.com/en-us/dotnet/api/microsoft.codeanalysis.iincrementalgenerator?view=roslyn-dotnet-4.7.0 adds some learning curve.
Some thoughts:
- Being code ( even generated) has , obvious, bugs. Can be improved
- Microsoft is pushing those – for the moments, are 12 : List of RSCG | RSCG Examples (ignatandrei.github.io) . However, for AOT , seems to be the direction
- Some are just glorified interpretors – for example, 103 – HangfireRecurringJob | RSCG Examples (ignatandrei.github.io) – translates an attribute to code. But also does a Mapper
- There are many ways to do same thing – see mapper category again at 105 RSCG by category | RSCG Examples (ignatandrei.github.io)
- To see the generated files put into the .csproj
<PropertyGroup>
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
<CompilerGeneratedFilesOutputPath>$(BaseIntermediateOutputPath)\GX</CompilerGeneratedFilesOutputPath>
</PropertyGroup>
Leave a Reply