diff --git a/.idea/.idea.HopFrame/.idea/workspace.xml b/.idea/.idea.HopFrame/.idea/workspace.xml
index 021c34d..99f649d 100644
--- a/.idea/.idea.HopFrame/.idea/workspace.xml
+++ b/.idea/.idea.HopFrame/.idea/workspace.xml
@@ -11,8 +11,14 @@
-
+
+
+
+
+
+
+
@@ -32,7 +38,7 @@
@@ -54,25 +60,34 @@
}
}
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
{}
{
@@ -101,7 +116,7 @@
"RunOnceActivity.git.unshallow": "true",
"b5f11219-dfc4-47a1-b02c-90ab603034fb.executor": "Debug",
"dcdf1689-dc07-47e4-8824-2e60a4fbf301.executor": "Debug",
- "git-widget-placeholder": "!24 on fix/relations",
+ "git-widget-placeholder": "!26 on fix/cancellabe-relations",
"list.type.of.created.stylesheet": "CSS",
"node.js.detected.package.eslint": "true",
"node.js.detected.package.tslint": "true",
@@ -207,7 +222,8 @@
-
+
+
@@ -433,7 +449,23 @@
1738062559567
-
+
+
+ 1738063028173
+
+
+
+ 1738063028173
+
+
+
+ 1738079122848
+
+
+
+ 1738079122848
+
+
@@ -484,8 +516,6 @@
-
-
@@ -509,6 +539,8 @@
-
+
+
+
\ No newline at end of file
diff --git a/README.md b/README.md
index d655ccd..bbd832b 100644
--- a/README.md
+++ b/README.md
@@ -72,6 +72,12 @@ builder.Services.AddHopFrame(options => {
});
```
+Then you need to map the frontend pages in your application:
+
+```csharp
+app.MapHopFrame();
+```
+
### Usage
- Navigate to `/admin` to access the admin dashboard and start managing your tables.
diff --git a/src/HopFrame.Core/Services/ITableManager.cs b/src/HopFrame.Core/Services/ITableManager.cs
index 93ba93d..4610ce0 100644
--- a/src/HopFrame.Core/Services/ITableManager.cs
+++ b/src/HopFrame.Core/Services/ITableManager.cs
@@ -12,5 +12,5 @@ public interface ITableManager {
public Task AddItem(object item);
public Task RevertChanges(object item);
- public Task DisplayProperty(object? item, PropertyConfig prop, object? value = null);
+ public Task DisplayProperty(object? item, PropertyConfig prop, object? value = null, object? enumerableValue = null);
}
\ No newline at end of file
diff --git a/src/HopFrame.Core/Services/Implementations/TableManager.cs b/src/HopFrame.Core/Services/Implementations/TableManager.cs
index d002512..c6dfb37 100644
--- a/src/HopFrame.Core/Services/Implementations/TableManager.cs
+++ b/src/HopFrame.Core/Services/Implementations/TableManager.cs
@@ -2,6 +2,7 @@
using System.ComponentModel.DataAnnotations;
using HopFrame.Core.Config;
using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.ChangeTracking;
namespace HopFrame.Core.Services.Implementations;
@@ -49,7 +50,14 @@ internal sealed class TableManager(DbContext context, TableConfig config
}
public async Task RevertChanges(object item) {
- await context.Entry((TModel)item).ReloadAsync();
+ var entry = context.Entry((TModel)item);
+ await entry.ReloadAsync();
+
+ if (entry.Collections.Any()) {
+ context.ChangeTracker.Clear();
+ }
+
+ await context.SaveChangesAsync();
}
private bool ItemSearched(TModel item, string searchTerm) {
@@ -66,7 +74,7 @@ internal sealed class TableManager(DbContext context, TableConfig config
return false;
}
- public async Task DisplayProperty(object? item, PropertyConfig prop, object? value = null) {
+ public async Task DisplayProperty(object? item, PropertyConfig prop, object? value = null, object? enumerableValue = null) {
if (item is null) return string.Empty;
if (prop.IsListingProperty)
@@ -81,12 +89,12 @@ internal sealed class TableManager(DbContext context, TableConfig config
}
if (prop.IsEnumerable) {
- if (value is not null) {
+ if (enumerableValue is not null) {
if (prop.EnumerableFormatter is not null) {
- return await prop.EnumerableFormatter.Invoke(value, provider);
+ return await prop.EnumerableFormatter.Invoke(enumerableValue, provider);
}
- return value.ToString() ?? string.Empty;
+ return enumerableValue.ToString() ?? string.Empty;
}
return (propValue as IEnumerable)!.OfType