Skip to content

Commit d5c9400

Browse files
Update README.md
Readme.md update.
1 parent 8431f2f commit d5c9400

File tree

1 file changed

+65
-9
lines changed

1 file changed

+65
-9
lines changed

README.md

+65-9
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,6 @@ HyperCache is developed in **Microsoft Visual Studio Enterprise 2022 (64-bit) -
1313
- **MSSQL**: Ensures data persistence with SQL Server.
1414
- **Scalable Architecture**: Designed for ease of use and scalability in enterprise environments.
1515

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-
2316
## Performance Comparison Table (1M Rows)
2417

2518
| Metric | Before Implementation (1M Rows) | After Implementation (1M Rows) |
@@ -79,11 +72,74 @@ Follow these steps to set up the HyperCache project:
7972
```bash
8073
dotnet run
8174
```
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`
82131

83-
## Usage
132+
Ensure the `CustomProperty` entity includes a `RowVersion` column:
84133

134+
```csharp
135+
public class CustomProperty
136+
{
137+
public int Id { get; set; }
85138

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+
```
87143

88144
## Summary of Delta Package Implementation
89145

0 commit comments

Comments
 (0)