- 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 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
HttpClient is a class in C# that is used for making HTTP calls of different kinds (most commonly Get/Put/Delete/Post).This class comes from namespace System.Net.Http
Most commonly used methods of this class are
- GetAsync
- DeleteAsync
- PostAsync
- PutAsync
- Dispose
💡Tracking vs Non Tracking Queries in .NET 1) Tracking Queries 2) Non Tracking Queries 3) Identity Resolution 4) How to set tracking by default for context🧵🔽 #dotnet
𝐓𝐫𝐚𝐜𝐤𝐢𝐧𝐠 : By default all queries are tracked , so behind the seen a change tracker keeps working on each entity. If you want to perform Update/Delete then you should use tracking. #dotnet
𝐍𝐨𝐧 𝐓𝐫𝐚𝐜𝐤𝐢𝐧𝐠 : If you just need read only data then you don't need your queries to keep tracking of change , you can simply go with no tracking and help the query run more speedy. #dotnet