/// <summary> /// 删除用户角色信息 /// </summary> /// <param name="ids">用户角色信息编号</param> /// <returns>业务操作结果</returns> public async Task <OperationResult> DeleteUserRoles(Guid[] ids) { List <string> userNames = new List <string>(); OperationResult result = await UserRoleRepository.DeleteAsync(ids, (entity) => { string userName = UserRoleRepository.QueryAsNoTracking(m => m.UserId == entity.UserId).Select(m => m.User.UserName).FirstOrDefault(); userNames.AddIfNotNull(userName); return(Task.FromResult(0)); }); if (result.Succeeded && userNames.Count > 0) { OnlineUserCacheRemoveEventData eventData = new OnlineUserCacheRemoveEventData() { UserNames = userNames.ToArray() }; await EventBus.PublishAsync(eventData); } return(result); }