public static async void AfterInsertedAsync(IInsertedEntry <SysMenu, DbContext> entry) { using (var service = AspectCoreContainer.Resolve <ISysMenuRepository>()) { var parentMenu = await service.GetSingleAsync(entry.Entity.ParentId); entry.Entity.MenuPath = (parentMenu?.MenuPath ?? "0") + "," + entry.Entity.Id; entry.Entity.SortIndex = entry.Entity.Id; service.Update(entry.Entity, false, "MenuPath", "SortIndex"); await DistributedCacheManager.RemoveAsync("Redis_Cache_SysMenu");//插入成功后清除缓存以更新 } }
public async void ServerInserted(IInsertedEntry <Server> server) { using (var scope = _serviceProvider.CreateScope()) { var authService = scope.ServiceProvider.GetService <IAuthorizationService>(); List <string> connections = new List <string>(); await Task.WhenAll(_hubConnectionManager.GetConnectedUsers <ServersHub>().Select(async connection => { var authResult = await authService.AuthorizeAsync(connection.Value, server.Entity, "ServerPolicy"); if (authResult.Succeeded) { if (!connections.Contains(connection.Key)) { connections.Add(connection.Key); } } })); await NotifyServerInserted(server.Entity, connections.ToArray()); } }
public static void AfterInserted(IInsertedEntry <SysMenu, DbContext> entry) { using (var service = AspectCoreContainer.Resolve <ISysMenuRepository>()) { if (string.IsNullOrEmpty(entry.Entity.ParentId)) { entry.Entity.MenuPath = entry.Entity.Id; } else { var parentMenu = service.GetSingle(entry.Entity.ParentId); if (string.IsNullOrEmpty(parentMenu?.MenuPath)) { entry.Entity.MenuPath = entry.Entity.Id; } else { entry.Entity.MenuPath = parentMenu.MenuPath + "," + entry.Entity.Id; } } service.Update(entry.Entity, false, "MenuPath"); DistributedCacheManager.Remove("Redis_Cache_SysMenu");//����ɹ�����������Ը��� } }
private void ResultProxy_Inserted(IInsertedEntry <ResultProxy, DbContext> obj) { Results_Changed(); }
private void SearchProxy_Inserted(IInsertedEntry <SearchProxy, DbContext> obj) { Searches_Changed(); }