- Properties are first class citizens in C#
- We used properties to achieve abstraction
- Properties are implemented via accessors
- Enable developers to write code that accurately expresses their design intent #dotnet
Read only Properties
- Serve the purpose of getters
- Use them for retrieving the information in DTO
- We can not set them
It is software assembled into an app pipeline to handle requests and responses. In simple, it gives us the facility to add additional logic before and after the HTTP request.
𝗛𝗼𝘄 𝗱𝗼𝗲𝘀 𝗺𝗶𝗱𝗱𝗹𝗲𝘄𝗮𝗿𝗲 𝘄𝗼𝗿𝗸 👇
Suppose we have three middleware in our app then for each middleware we enter two times.
First middleware logic is performed then we send it to the next middleware
Secondly when a request comes back after executing the next middleware
𝗧𝗵𝗿𝗲𝗲 𝘄𝗮𝘆𝘀 𝘁𝗼 𝗰𝗿𝗲𝗮𝘁𝗲 𝗺𝗶𝗱𝗱𝗹𝗲𝘄𝗮𝗿𝗲:
- Request delegate
- By convention
- Using middleware factory
What is SOLID , why we need these principles and S explained ?
It is combination of 5 design principles
S - Single Responsibility Principle (SRP)
O - Open/Closed Principle (ORP)
L - Liskov Substitution Principle (LSP)
I - Interface Segregation Principle (ISP)
Thread 🧵👇
D - Dependency Inversion Principle (DIP)
Why we need SOLID or its benefits
- Better Testability
- Reduces coupling
- Removes Duplication
- Increases Readability
- Increases Extensibility
SRP says :-
- A class/method should have one reason to change
- A class/method should have only one responsibility
- A class/method should be related to a single purpose
With SRP we achieve :-
- Class/method becomes smaller and cleaner
- Now in future updating the code becomes easier
📌Read these 15 awesome topics of .NET via my Newsletter.
Join 3400+ : for upcoming issues.
EP 14: 7 Awesome Features of C# (10)
EP 13: Bogus - A Fake Data Generation
EP 12: Global Exception Handling
EP 11: Default vs Autofac DI Container
EP 10: Action… https://t.co/62ug4BOMVBlnkd.in/dNHxJGRG twitter.com/i/web/status/1…
It states that don’t repeat yourself what it means it is saying don’t duplicate code , avoid duplication. Purpose is to reduce the redundant code in your application 🧵⏬ #dotnet
Following the DRY Principle can give us following benefits