Category: .NET Core
-
RSCG – System.Text.RegularExpressions
RSCG – System.Text.RegularExpressions name System.Text.RegularExpressions nuget https://www.nuget.org/packages/System.Text.RegularExpressions/ link https://learn.microsoft.com/en-us/dotnet/standard/base-types/regular-expression-source-generators/ author Microsoft Regex compiled This is how you can use System.Text.RegularExpressions . The code that you start with is The code that you will use is The code that is generated is Code and pdf at https://ignatandrei.github.io/RSCG_Examples/v2/docs/System.Text.RegularExpressions
-
RSCG – RSCG_Utils
RSCG – RSCG_Utils name RSCG_Utils nuget https://www.nuget.org/packages/RSCG_Utils link https://learn.microsoft.com/en-us/dotnet/standard/serialization/system-text-json/source-generation author Ignat Andrei Add files as C# consts This is how you can use RSCG_Utils . The code that you start with is The code that you will use is The code that is generated is Code and pdf at https://ignatandrei.github.io/RSCG_Examples/v2/docs/RSCG_Utils
-
RSCG – System.Text.Json
name System.Text.Json nuget https://www.nuget.org/packages/System.Text.Json/ link https://learn.microsoft.com/en-us/dotnet/standard/serialization/system-text-json/source-generation author Microsoft Json Serialize without reflection This is how you can use System.Text.Json . The code that you start with is The code that you will use is The code that is generated is Code and pdf at https://ignatandrei.github.io/RSCG_Examples/v2/docs/System.Text.Json
-
RSCG – RSCG_TimeBombComment
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 This is how you can use RSCG_TimeBombComment . The code that you start with is The code that you will use is The code that is generated is Code and…
-
RSCG – ThisAssembly
RSCG – ThisAssembly name ThisAssembly nuget https://www.nuget.org/packages/ThisAssembly link https://www.clarius.org/ThisAssembly/ author Daniel Cazzulino 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. This is how you can use ThisAssembly…
-
RSCG–ISourceGenerator porting to IIncrementalGenerator in 3 steps
Roslyn Source Code Generators (RSCG) have deprecated the ISourceGenerator (roslyn/source-generators.md at main · dotnet/roslyn · GitHub ) vs the new interface IIncrementalGenerator,roslyn/incremental-generators.md at main · dotnet/roslyn · GitHub . That because of the idea of speed of generating code – and the idea of not generating twice the same code. How is the implementation of…
-
File to CSharp Const
I was getting tired how many times I am reading from embedded resources – and finding it over and over the same code. So – what if I will transform the file into C# text ? Seems a work for Roslyn Source Code Generator – and the new one IIncrementalGenerator https://github.com/dotnet/roslyn/blob/main/docs/features/incremental-generators.md,not the old ISourceGenerator https://learn.microsoft.com/en-us/dotnet/csharp/roslyn-sdk/source-generators-overview…
-
DB2Code – part 8–closing
From now on the only work to be done is improving step by step the generating code. For example, 1. in the REST API,the code is accessing directly the database- should be an indirection layer 2. Should generate some mock classes to return data – instead of going to database ( or maybe EF In…
-
Db2Code–part 6 – implementation details
Problem 1 More dbContexts I have think that a user can have more than 1 DBContext / database implemented. If there was just only one,it were easy to add a partial to program.cs and register the database DI services.AddDbContext<ApplicationDBContext> in the partial . However,if each database is generated,how to have this ? The answer is …
-
Db2Code–part 5 – testing
For testing I should find some databases to test to ( and do not forget that generating SELECT from PK supports just 1 PK,not multiple). Microsoft already show some sample database – you can download from https://github.com/microsoft/sql-server-samples/tree/master/samples/databases . However,those must exists in the moment of running tests – so I have as options: Have an…