Category: RSCG
- 
			
			
Demeter and Roslyn–part 3–config and tests
Beyond the Squiggles: Flexible Reporting and Confidence Through Testing So,we’ve built our Law of Demeter analyzer,RSCG_Demeter,using Roslyn to intelligently spot those overly-chatty code chains,even navigating the complexities of fluent interfaces. We could just have it throw warnings or errors directly in your IDE via Roslyn diagnostics. But let’s be honest,sometimes a flood of new diagnostics…
 - 
			
			
Demeter and Roslyn–part 2- code
Okay,let’s build on the first part and explain the “how” in a more engaging way,weaving in the code snippets to illustrate the process. From Counting Dots to Understanding Code: Building the Demeter Analyzer In the first part,we established our mission: build a Roslyn analyzer to sniff out Law of Demeter violations – stopping our code…
 - 
			
			
Demeter and Roslyn–part 1–idea
Stop Your C# Code Talking to Strangers: Introducing a Law of Demeter Roslyn Analyzer The Law of Demeter (LoD),often summarized as “Only talk to your immediate friends,” is a valuable principle for writing loosely coupled,maintainable code. Code that follows LoD tends to be less fragile and easier to refactor. But manually checking for LoD violations?…
 - 
			
			
RSCG – EntityLengths.Generator
RSCG – EntityLengths.Generator name EntityLengths.Generator nuget https://www.nuget.org/packages/EntityLengths.Generator/ link https://github.com/TarasKovalenko/EntityLengths.Generator/ author Taras Kovalenko Generating constants for max length for properties in entities This is how you can use EntityLengths.Generator . The code that you start with is The code that you will use is The code that is generated is Code and…
 - 
			
			
RSCG – RSCG_CompositeProvider
RSCG – RSCG_CompositeProvider name RSCG_CompositeProvider nuget https://www.nuget.org/packages/RSCG_CompositeProvider/ https://www.nuget.org/packages/RSCG_CompositeProvider_common/ link https://github.com/ignatandrei/RSCG_CompositeProvider author Ignat Andrei Generate composite class from interface,using multiple sources This is how you can use RSCG_CompositeProvider . The code that you start with is The code that you will use is The code that is generated is Code and pdf…
 - 
			
			
RSCG – DependencyModules.SourceGenerator
RSCG – DependencyModules.SourceGenerator name DependencyModules.SourceGenerator nuget https://www.nuget.org/packages/DependencyModules.SourceGenerator/ https://www.nuget.org/packages/DependencyModules.Runtime/ link https://github.com/ipjohnson/DependencyModules author Ian Johnson Generating service dependencies from attributes. Also,by the author,a more advanced example you will find in the DemoWithTest.zip inside the zip file This is how you can use DependencyModules.SourceGenerator . The code that you start with is The code that…
 - 
			
			
RSCG – MockMe
RSCG – MockMe name MockMe nuget https://www.nuget.org/packages/MockMe/ link https://github.com/connorivy/MockMe/ author connorivy Creating mocks for testing classes This is how you can use MockMe . 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/MockMe
 - 
			
			
RSCG – rscg_Interface_to_null_object
RSCG – rscg_Interface_to_null_object name rscg_Interface_to_null_object nuget https://www.nuget.org/packages/rscg_Interface_to_null_object/ https://www.nuget.org/packages/rscg_Interface_to_null_object_common link https://github.com/ignatandrei/rscg_Interface_to_null_object/ author Andrei Ignat Generate null objects for interfaces This is how you can use rscg_Interface_to_null_object . 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_Interface_to_null_object
 - 
			
			
What I use for a csproj for a Roslyn Code Generator
My csproj file looks like this And now a detailed explanation Project Sdk <Project Sdk=”Microsoft.NET.Sdk”> This tag specifies the SDK to use for the project. The Microsoft.NET.Sdk is a general-purpose SDK for .NET projects. PropertyGroup <PropertyGroup> <TargetFramework>netstandard2.0</TargetFramework> <LangVersion>12.0</LangVersion> <Nullable>enable</Nullable> <ImplicitUsings>enable</ImplicitUsings> <IsRoslynComponent>true</IsRoslynComponent> <EnforceExtendedAnalyzerRules>true</EnforceExtendedAnalyzerRules> </PropertyGroup> TargetFramework: Targets .NET Standard 2.0,ensuring compatibility with a wide range of .NET…
 - 
			
			
RSCG – Pure.DI
RSCG – Pure.DI name Pure.DI nuget https://www.nuget.org/packages/Pure.DI/ link https://github.com/DevTeam/Pure.DI author Nikolay Pianikov Constructing injecting container This is how you can use Pure.DI . 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/Pure.DI