Wednesday 27 December 2023
C# Enum Value and Display name Extension
Friday 4 August 2023
C# simple example for recursive call
Friday 21 July 2023
Mapster over AutoMapper for mapping objects in c# Crud
1.Add Mapster packages from NuGet
2.Create Source class
3.Create Destination class
4.Create Service or repository class where mapping required to convert Dto to Enity object.
Simple Save and Retrieve example below for using mapster and entity framework.
Why Mapster over Auto mapper
Method | Mean | StdDev | Error | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|
'Mapster 6.0.0' | 108.59 ms | 1.198 ms | 1.811 ms | 31000.0000 | - | - | 124.36 MB |
'Mapster 6.0.0 (Roslyn)' | 38.45 ms | 0.494 ms | 0.830 ms | 31142.8571 | - | - | 124.36 MB |
'Mapster 6.0.0 (FEC)' | 37.03 ms | 0.281 ms | 0.472 ms | 29642.8571 | - | - | 118.26 MB |
'Mapster 6.0.0 (Codegen)' | 34.16 ms | 0.209 ms | 0.316 ms | 31133.3333 | - | - | 124.36 MB |
'ExpressMapper 1.9.1' | 205.78 ms | 5.357 ms | 8.098 ms | 59000.0000 | - | - | 236.51 MB |
'AutoMapper 10.0.0' | 420.97 ms | 23.266 ms | 35.174 ms | 87000.0000 | - | - | 350.95 MB |
Monday 9 January 2023
Azure Cosmo DB
Azure Cosmo DB used to store non Sql data that is collection of objects.
Important key stack properties are id and partition key.
Partition Key is kind of grouping / or like disk drive C, D drive in our PC,Lap.
Make sure partition key as perfect column Ex: need to retrieve data frequently day wise means then i will make CreatedDate as partition key (CreatedDate= DateTime.UtcNow.Date)
id: its mandatory property & non-nullable
Unique/Primary key: will be combination of Partition Key + id
we can insert same id again but it's partition should be different. also, we can store different type of object but that object should contain same id and partition key.
Hierarchy: Example based OrderGroups is container
-->Data Base
|__ Container: kind of table or entity name
|__ Items: Kind of Table Entity values
|__Stored Procedure
|__User Defined Functions & Stored Procedure
|__ Triggers