Enhance SyncManager to raise events which can be handled on the server within hosted services. Raise create, update, delete events for all major entities. Include support for refresh and reload events to synchronize client state. Move client state cache invalidation to a hosted service to separate concerns and demonstrate events.

This commit is contained in:
Shaun Walker
2022-10-04 19:20:02 -04:00
parent 68ada8fbe4
commit c5b632cb24
27 changed files with 212 additions and 92 deletions

View File

@ -9,12 +9,12 @@ namespace Oqtane.Models
public List<SyncEvent> SyncEvents { get; set; }
}
public class SyncEvent
public class SyncEvent : EventArgs
{
public int TenantId { get; set; }
public string EntityName { get; set; }
public int EntityId { get; set; }
public bool Reload { get; set; }
public string Action { get; set; }
public DateTime ModifiedOn { get; set; }
}
}

View File

@ -2,15 +2,25 @@ namespace Oqtane.Shared
{
public class EntityNames
{
public const string Alias = "Alias";
public const string File = "File";
public const string Folder = "Folder";
public const string Job = "Job";
public const string Language = "Language";
public const string Module = "Module";
public const string ModuleDefinition = "ModuleDefinition";
public const string PageModule = "PageModule";
public const string Tenant = "Tenant";
public const string Site = "Site";
public const string Notification = "Notification";
public const string Page = "Page";
public const string Folder = "Folder";
public const string PageModule = "PageModule";
public const string Profile = "Profile";
public const string Role = "Role";
public const string Setting = "Setting";
public const string Site = "Site";
public const string Tenant = "Tenant";
public const string UrlMapping = "UrlMapping";
public const string User = "User";
public const string UserRole = "UserRole";
public const string Visitor = "Visitor";
public const string Host = "Host";
public const string Host = "Host"; // a conceptual entity
}
}

View File

@ -0,0 +1,12 @@
namespace Oqtane.Shared {
public class SyncEventActions {
// client actions for PageState management
public const string Refresh = "Refresh";
public const string Reload = "Reload";
// server actions for raising Events
public const string Create = "Create";
public const string Update = "Update";
public const string Delete = "Delete";
}
}