@@ -13,13 +13,6 @@ HyperCache is developed in **Microsoft Visual Studio Enterprise 2022 (64-bit) -
13
13
- ** MSSQL** : Ensures data persistence with SQL Server.
14
14
- ** Scalable Architecture** : Designed for ease of use and scalability in enterprise environments.
15
15
16
- ## Benefits of Using the Delta Package
17
- Using the Delta package improves the efficiency of API responses by sending only the changes instead of the entire dataset. This results in:
18
- - ** Reduced payload size** : Only the modified or new data is transmitted.
19
- - ** Faster API responses** : Optimized data transmission improves application performance.
20
- - ** Better scalability** : Decreased bandwidth usage allows handling more requests efficiently.
21
- - ** Improved user experience** : Faster load times enhance user interaction.
22
-
23
16
## Performance Comparison Table (1M Rows)
24
17
25
18
| Metric | Before Implementation (1M Rows) | After Implementation (1M Rows) |
@@ -79,11 +72,74 @@ Follow these steps to set up the HyperCache project:
79
72
``` bash
80
73
dotnet run
81
74
```
75
+
76
+ 4 . ** Build and run the Blazor UI** : Use Blazor components for interactive user interfaces.
77
+
78
+ ## How to Configure Delta Package
79
+
80
+ To properly configure and use the Delta package in HyperCache, follow these steps:
81
+
82
+ ### Step 1: Modify ` OnModelCreating ` in the ` DbContext `
83
+
84
+ In your ` AppDbContext.cs ` file, configure the ` RowVersion ` column for delta tracking:
85
+
86
+ ``` csharp
87
+ protected override void OnModelCreating (ModelBuilder modelBuilder )
88
+ {
89
+ base .OnModelCreating (modelBuilder );
90
+
91
+ var customProperty = modelBuilder .Entity <CustomProperty >();
92
+ customProperty .HasKey (cp => cp .Id );
93
+
94
+ // Configures RowVersion for Delta Package
95
+ customProperty
96
+ .Property (cp => cp .RowVersion )
97
+ .IsRowVersion ()
98
+ .HasConversion <byte []>();
99
+ }
100
+ ```
101
+
102
+ ### Step 2: Register Delta Middleware in ` Program.cs `
103
+
104
+ Ensure the Delta package is registered before mapping controllers:
105
+
106
+ ``` csharp
107
+ var builder = WebApplication .CreateBuilder (args );
108
+
109
+ builder .Services .AddDbContext <AppDbContext >(options =>
110
+ options .UseSqlServer (builder .Configuration .GetConnectionString (" DefaultConnection" )));
111
+
112
+ builder .Services .AddControllers ();
113
+
114
+ // Register Delta middleware
115
+ builder .Services .AddDelta <AppDbContext >();
116
+
117
+ var app = builder .Build ();
118
+
119
+ app .UseHttpsRedirection ();
120
+ app .UseAuthorization ();
121
+
122
+ // Enable Delta middleware
123
+ app .UseDelta <AppDbContext >();
124
+
125
+ app .MapControllers ();
126
+
127
+ app .Run ();
128
+ ```
129
+
130
+ ### Step 3: Define Entity Model with ` RowVersion `
82
131
83
- ## Usage
132
+ Ensure the ` CustomProperty ` entity includes a ` RowVersion ` column:
84
133
134
+ ``` csharp
135
+ public class CustomProperty
136
+ {
137
+ public int Id { get ; set ; }
85
138
86
- 4 . ** Build the Blazor UI** : Use Blazor components for interactive user interfaces.
139
+ [Timestamp ] // Required for EF Core concurrency tracking
140
+ public byte [] RowVersion { get ; set ; }
141
+ }
142
+ ```
87
143
88
144
## Summary of Delta Package Implementation
89
145
0 commit comments