Category: .NET
-
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…
-
What I have learned by building .NET Stars -part 5 – always available data for a display website
What I have learned by building .NET Stars -part 5 – always available data for a display website Dotnet Stars being a site just for displaying data,it does not require an API per se. Yes,for development purposes it needs a database and an API to display – but later – the data could be retrieved…
-
RSCG-Composite Provider – part 2 -execution
Imagine this: For every interface IA you create: Your composite provider implements IA seamlessly In the constructor,pass an array of IA providers Each method returns the first successful value from your array of providers For even better performance,use a boolean flag to optimize by reusing previous successes The RSCG_CompositeProvider package doesnΓÇÖt just solve the obvious…
-
RSCG-Composite Provider – part 1 -idea
API Outage solved with local data The problem that I try to solve is : How an UI can have data to show,even if the API from where it gathers data does not work ? Imagine having a robust system that adaptively switches between retrieving data from multiple sources – including internal APIs,memory-based storage,or even…
-
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
-
Pattern: CompositeProvider
Description Composite Provider pattern is a structural design pattern that lets you compose objects into tree structures to represent part-whole hierarchies. Composite lets clients treat individual objects and compositions of objects uniformly. Example in .NET : CompositeProvider And his usage Learn More Source Code for Microsoft implementation of CompositeProvider SourceCode Composite Provider Learn More File…
-
What I have learned by building .NET Stars -part 4- Keyed Dependency Injection – constructor by keys
As I said before,I have constructed first the interfaces. Then I have a null object pattern for each interface,constructed automatically with a Roslyn Code Generator,https://www.nuget.org/packages/rscg_Interface_to_null_object . And now,what I want is to have keyed DI for each new implementation -with a twist: It’s like a game of matching keys when another class is injected,the first…