public override async Task <bool> IsClientIncluded(int clientId) { using (var scope = _taskService.Services.CreateScope()) { return(await _aggregatedClientFilter.IsClientIncluded(clientId, scope.ServiceProvider)); } }
public async Task <List <TaskSyncDto> > BizActionAsync(int inputData) { var tasks = new List <TaskSyncDto>(); foreach (var taskInfo in _mazeTaskManager.ClientTasks) { var filters = new AggregatedClientFilter(_services.GetRequiredService <ILogger <AggregatedClientFilter> >()); filters.Add(new AudienceFilter(taskInfo.MazeTask.Audience)); foreach (var filterInfo in taskInfo.MazeTask.Filters) { var filterType = typeof(IFilterService <>).MakeGenericType(filterInfo.GetType()); filters.Add(new CustomFilterFactory(filterType, filterInfo, _services.GetRequiredService <ILogger <CustomFilterFactory> >())); } if (!await filters.IsClientIncluded(inputData, _services)) { continue; } tasks.Add(new TaskSyncDto { TaskId = taskInfo.MazeTask.Id, Hash = taskInfo.Hash.ToString() }); } return(tasks); }