Category: roslyn
-
DI for Functions- work–part 2
Let’s begin with tests – we need to have a class with multiple functions that have multiple [FromServices} parameter. Like public bool TestMyFunc1([FromServices] TestDI1 t1,[FromServices] TestDI2 t2,int x,int y) { return true; } public bool TestMyFunc2([FromServices] TestDI1 t12, int x,int y) { return true; } // more others Because there are multiple functions,I need to…
-
Templating Roslyn Source Code Generators
I want that,when I generate code with Roslyn,to have a template that I can easy modify to generate code . Also,I want to let the user ( the programmer,in this case) modify this template – maybe he has better ideas than me. For reading from the RSCG,is pretty simple: Make as an embedded resource and…
-
[RSCG]–About My Software
I have made a new improvement to my Roslyn Source Code Generator,AMS . Until now it just said the time and the commit date in a CI scenario ( Git ( GitLab,GitHub),Azure …) Now – what if it can list all the merge requests between 2 dates ,so you can see what is new ? Now…
-
FileExtension– export data from CSV–part 2
First,is how to export data from table (https://en.wikipedia.org/wiki/List_of_file_signatures) into classes . First,the table must be transformed into a more programmatic recognizable way – like a CSV – see https://github.com/ignatandrei/FileExtension/blob/master/src/RSCG_GCK/offset0.txt Then a solution is to have into the dll ( as embedded resource or as a file) . The second solution,more complicated,is to use Roslyn Source…
-
Evolving Roslyn Source Code Generators
I am a big fan of Roslyn Source Code Generators – you can read about at https://github.com/dotnet/roslyn/blob/main/docs/features/source-generators.md and https://devblogs.microsoft.com/dotnet/introducing-c-source-generators/. I have tested,until now,27 examples and discovered other 53 RSCG – you can read about at https://github.com/ignatandrei/RSCG_Examples and download the book from https://ignatandrei.github.io/RSCG_Examples/ Also,Microsoft is dogfooding this by using at Blazor ( https://devblogs.microsoft.com/aspnet/asp-net-core-updates-in-net-6-preview-2/#razor-compiler-updated-to-use-source-generators ),JSON.NET https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-source-generator/ .…
-
RSCG Example – AOPMarker for CI Builds – part 30
name AOPMarkerCI nuget https://www.nuget.org/packages/AOPMethodsCommon/ https://www.nuget.org/packages/AOPMethodsGenerator/ link http://msprogrammer.serviciipeweb.ro/category/roslyn/ author Andrei Ignat This will tracing methods marked with AOPMarkerMethod in CI builds. Does not affect the code run by the programmer. The code that you start with is The code that you will use is The code that is generated is Example Code:…
-
RSCG Example – Class2Interface – part 29
name BoilerplateFree nuget https://www.nuget.org/packages/boilerplatefree link https://github.com/GeeWee/boilerplatefree author Gustav Wengel This will generate interface from a class The code that you start with is The code that you will use is The code that is generated is Example Code: https://github.com/ignatandrei/RSCG_Examples/tree/main/Class2Interface
-
RSCG Example – ToStringDebugger – part 28
name StructRecordsGenerator nuget https://www.nuget.org/packages/StructRecordGenerator/ link https://github.com/SergeyTeplyakov/StructRecordsGenerator author Sergey Teplyakov This will generate code .ToString. Usefull for debugging The code that you start with is The code that you will use is The code that is generated is Example Code: https://github.com/ignatandrei/RSCG_Examples/tree/main/DebuggerToString
-
RSCG Example–TimeBombComment–part 27
name RSCG_TimeBombComment nuget https://www.nuget.org/packages/RSCG_TimeBombComment/ link http://msprogrammer.serviciipeweb.ro/category/roslyn/ author Andrei Ignat This will generate an error from the comment after a certain date The code that you start with is The code that you will use is The code that is generated is Example Code: https://github.com/ignatandrei/RSCG_Examples/tree/main/TimeBombComment
-
RSCG Example–ApparatusAOT–part 26
name ApparatusAOT nuget https://www.nuget.org/packages/Apparatus.AOT.Reflection/ link https://github.com/byme8/Apparatus.AOT.Reflection author Stanislav Silin This will generate code for investigating at runtime the properties of an object The code that you start with is The code that you will use is The code that is generated is Example Code: https://github.com/ignatandrei/RSCG_Examples/tree/main/ApparatusAOT