You have 27 examples with my own source codes ( see below).
Also, there are 53 more examples waiting to be discovered/analyzed by you .
Nr. | Name | Summary |
1 |
See in action: ThisAssembly
Other links: |
The ThisAssembly.Info allows you access to the Assembly Information as constants, instead of going to reflection each time. I found useful to see the assembly version right away in any project that I have. |
2 |
See in action: Enum
Other links: |
This will generate code to fast parsing a int or a string to an enum |
3 |
See in action: JsonByExampleGenerator
Other links: |
This will generate C# classes from json files. |
4 |
See in action: CopyConstructor + Deconstructor
Other links: |
This will generate code for a POCO to generate copy constructor and deconstructor |
5 |
See in action: GeneratedMapper
Other links: |
AutoMapping from a POCO to a DTO. Lots of customizations |
6 |
See in action: Skinny Controllers
Other links: |
This will generate code for WebAPI for each method of a field in the controller |
7 |
See in action: data-builder-generator
Other links: |
Implements the Builder Design pattern for any class. Useful , at least, for test projects |
8 |
See in action: Metadata from object
Other links: |
This will generate code to retrieve the values of properties directly, not by reflection |
9 |
See in action: MockSourceGenerator
Other links: |
This will generate Mock classes directly for any interface - with your implementation. |
10 |
See in action: Method decorator
Other links: |
This will generate code to decorate methods with anything you want ( stopwatch, logging , authorization...) |
11 |
See in action: PartiallyApplied
Other links: |
This will generate curry for your functions |
12 |
See in action: IFormattable
Other links: |
This will generate code to add IFormattable to any class, based on the properties of the class |
13 |
See in action: AutoInterface
Other links: |
Implement the Design Pattern Decorator. Based on template - you can modify the source code generated |
14 |
See in action: Property Expression Generator
Other links: |
This will generate code to add function to be used with Entity Framework to search for any property of a class |
15 |
See in action: Transplator
Other links: |
The Transplator is a small fast rendering engine to allow you to make rendering from any class instance. |
16 |
See in action: RSCG_AMS
Other links: |
The AMS will add in the CI the version and creator to your project.See https://netcoreblockly.herokuapp.com/ams for an example |
17 |
See in action: HttpClientGenerator
Other links: |
HttpClientGenerator is a tool that uses Roslyn code generator feature to write boilerplate HttpClient code for you. |
18 |
See in action: DatabaseToWebAPI
Other links: |
This will generate code (WebAPI/Swagger) for any table/view from SqlServer. You can see the table via Angular |
19 |
See in action: SourceInject
Other links: |
Auto register services in startup |
20 |
See in action: Static To Interface
Other links: |
This will generate code for any static properties of a class to generate interface, record and a class with real behaviour |
21 |
See in action: BaseTypes
Other links: |
Generated tiny types from any value type |
22 |
See in action: AppSettingsEditor
Other links: |
This will generate classes code from appsettings . Additionally , it generates API controller for editing and an UI interface |
23 |
See in action: ApparatusAOT
Other links: |
This will generate code for investigating at runtime the properties of an object |
24 |
See in action: RSCG_TimeBombComment
Other links: |
This will generate an error from the comment after a certain date |
25 |
See in action: StructRecordsGenerator
Other links: |
This will generate code .ToString. Usefull for debugging |
26 |
See in action: AOPMarkerCI
Other links: |
This will tracing methods marked with AOPMarkerMethod in CI builds. Does not affect the code run by the programmer. |
27 |
See in action: BoilerplateFree
Other links: |
This will generate interface from a class |
There are more awesome RSCG that you could use - here is a list of 53 RSCG that you may want to look at:
Nr | Name | Description |
---|---|---|
1 | chsienki/AutoEmbed | Source generator to easily embed and access files + directory trees |
2 | mostmand/Cloneable | Auto generate Clone method using C# Source Generator |
3 | jeromelaban/fonderie | A source generator for the INotifyPropertyChanged interface using the Uno.SourceGenera tion framework |
4 | excubo-ag/Generators.Blazor | This project improves the performance of Blazor components using source generators and provides helpful diagnostics. |
5 | excubo-ag/Generators.Grouping | Some APIs have a lot of methods. When they all reside in the same ob ject, finding the right API call can be a challenge to the users. But replacing the structure of the API from a monolithic API to an API with intuitively named and smaller groups would break existing code. The solution is to offer both, without having to write the grouping yourself. |
6 | ladeak/JsonMergePatch | Provides an implementation for Json Merge Patch, RFC7396. Library using C# source ge nerators to generate the types required for serialization. The Http package provides extension methods for HTTP requests, while the AspNetCore package provides an InputReader implementation. |
7 | Zoxive/MemoizeSourceGenerator | Memoize |
8 | Tyrrrz/MiniRazor | Portable Razor compiler & code generator |
9 | thomas-girotto/MockGen | A C# mocking library based on source generators |
10 | Sholtee/proxygen | .NET proxy generator powered by Roslyn |
11 | JasonBock/Rocks | A mocking library based on the Compiler APIs (Roslyn + Mocks) |
12 | Jishun/RoslynWeave | An AOP code generator |
13 | devlooped/SmallSharp | Create, edit and run multiple C# 9.0 top-level programs in the same project by just selecting the startup program from the start button. |
14 | robertturner/StaticProxyGenerator | Interface proxy generator. At compile time creates class th at implements target interface. Instantiation of the generated class accepts an InterceptorHandler which is called for all method calls |
15 | ufcpp/ValueChangedGenerator | Roslyn Code Fix / Source Generator for generating PropertyChanged from inner struct members. |
16 | mattiasnordqvist/Web-Anchor | Web Anchor provides type-safe, testable and flexible, runtime-generated access to web resources. |
17 | martinothamar/WrapperValueObject | A .NET source generator for creating simple value objects wra pping primitive types. |
18 | gabriele-tomassetti/code-generation-roslyn | Code generation with Roslyn and parsing w ith Sprache |
19 | YairHalberstadt/stronginject | compile time dependency injection for .NET |
20 | thinktecture/article-roslyn-source-generators | Roslyn Source Generators, Analyzers and Code Fixes |
21 | HamedFathi/MockableStaticGenerator | A C# source generator to make an interface and a class wr apper to test static/extension methods. |
22 | mrtaikandi/MapTo | A convention based object to object mapper using Roslyn source generator. |
23 | dominikjeske/Dnf.SourceGenerators | SourceGenerators |
24 | Flash0ver/F0.Generators | The open source of truth for general-purpose C# source code generators. |
25 | giggio/sourceinject | A source generator for C# that uses Roslyn (the C# compiler) to allow you to generate y our dependencies injection during compile time. |
26 | anton-yashin/LightMock.Generator | aot mock generator |
27 | sungaila/Cdelta | A C# source generator for finite-state machines ??? easily referenced as a Roslyn analyzer. |
28 | JoshDiDuca/CodeSourceGenerator | Generates code from templates using the new roslyn source generat or. |
29 | MelGrubb/BuilderGenerator | A source-generator-based implementation of the Builder pattern |
30 | MelGrubb/BuilderGenerator | A source-generator-based implementation of the Builder pattern |
31 | MelGrubb/BuilderGenerator | A source-generator-based implementation of the Builder pattern |
32 | MelGrubb/BuilderGenerator | A source-generator-based implementation of the Builder pattern |
33 | wieslawsoltes/Svg.Skia | An SVG rendering library. |
34 | marlond18/EMDD.KtEquatable | C# 9.0 Source Generator for IEnumerable |
35 | petarpetrovt/fast-enum-string | A source generator for generating a faster extension method for con verting an enumeration value to string. |
36 | andrewlock/StronglyTypedId | A Rosyln-powered generator for strongly-typed IDs |
37 | vrenken/EtAlii.Generators | A set of Roslyn generators to simplify usage of some of the more mainstream frameworks/libraries. |
38 | ashmind/SourceMock | SourceMock is a C# mocking framework based on source generators |
39 | SergeyTeplyakov/StructRecordsGenerator | A set of generators helping dealing with structs in C# |
40 | mehmetakbulut/SignalR.Strong | Strongly-typed calls from client to server and handlers for calls fro m server to client |
41 | canton7/RestEase | Easy-to-use typesafe REST API client library for .NET Standard 1.1 and .NET Framework 4.5 and higher, which is simple and customisable. Inspired by Refit |
42 | byme8/DuckInterface | Experiments for duck typing support in C#. |
43 | byme8/ZeroIoC | ZeroIoC is reflectionless IoC Container for .NET |
44 | Cysharp/UnitGenerator | C# Source Generator to create value-object, inspired by units of measure. |
45 | GeeWee/boilerplatefree | Remove boilerplate via C# 9 source generators and attributes. Allows you to auto- generate interfaces from classes, constructors from fields and more |
46 | GeeWee/boilerplatefree | Remove boilerplate via C# 9 source generators and attributes. Allows you to auto- generate interfaces from classes, constructors from fields and more |
47 | MelGrubb/BuilderGenerator | A source-generator-based implementation of the Builder pattern |
48 | MelGrubb/BuilderGenerator | A source-generator-based implementation of the Builder pattern |
49 | MelGrubb/BuilderGenerator | A source-generator-based implementation of the Builder pattern |
50 | MelGrubb/BuilderGenerator | A source-generator-based implementation of the Builder pattern |
51 | panoukos41/ViewBindingsGenerator | A project that generates a partial class (view) for Activitie s/Fragments that will contain properties with the same name as their android:id in the xml view file. |
52 | alekshura/SourceMapper | Mappings code generator based on attributes |
53 | Burgyn/MMLib.MediatR.Generators | This generator generates controllers and their methods for you based on your MediatR requests. |
https://github.com/dotnet/roslyn/blob/master/docs/features/source-generators.md
https://github.com/dotnet/roslyn/blob/master/docs/features/source-generators.cookbook.md
https://github.com/dotnet/roslyn-sdk/tree/master/samples/CSharp/SourceGenerators
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
<CompilerGeneratedFilesOutputPath>$(BaseIntermediateOutputPath)Generated</CompilerGeneratedFilesOutputPath>
In the RSCG project
<PropertyGroup>
<TargetFrameworks>netstandard2.0</TargetFrameworks>
<IsRoslynComponent>true</IsRoslynComponent>
</PropertyGroup>
```xml
In the project
```xml
<ItemGroup>
<ProjectReference Include="Path_To_The.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
</ItemGroup>