private async void PostgreSQLDemonstrationTaskHandlerService_TaskRecieve(DNet_DataContracts.Processing.Task task) { Console.WriteLine("PSQL Service: " + task.Id); if (!task.ModuleType.Contains(_connectionInstance.ModuleType) || task.Type != DNet_DataContracts.Processing.TaskType.Search) { await _connectionInstance.SendToHub("ModuleUnsupportTaskType", task); return; } SearchTaskContext context = task.SearchContext; Type type = null; IQueryable queryable; switch (context.SearchArea) { case "user": type = typeof(User); //queryable = _context.Users.Where(context.SearchExpression); break; case "news": type = typeof(News); break; default: break; } if (type == null) { await _connectionInstance.SendToHub("ModuleUnsupportTaskType", task); return; } task.IsFinished = true; task.SearchContext.Result = "Scope from DB"; await _connectionInstance.SendToHub("TaskResult", task); //ParameterExpression usedType = Expression.Parameter(type, context.SearchAlias); //LambdaExpression e = DynamicExpressionParser.ParseLambda(new ParameterExpression[] { usedType }, null, context.SearchExpression); }
internal async void SendTask() { //DNet_DataContracts.Processing.Task task = new DNet_DataContracts.Processing.Task //{ // Id = Guid.NewGuid().ToString(), // Type = TaskType.Search, // ModuleType = "DB, DB_Postgres" //}; //SearchTaskContext context = new SearchTaskContext //{ // SearchAlias = "user" //}; //task.SearchContext = context; var task = new DNet_DataContracts.Processing.Task { Id = Guid.NewGuid().ToString(), Type = TaskType.Search, ModuleType = TaskModuleTypes }; SearchTaskContext context = new SearchTaskContext { SearchArea = "user" }; if (uITypeEvaluateService.TypeMemoryConsumptionDictionary.TryGetValue("User", out long temp)) { context.ApproximateResultTypeMemoryConsumption = temp; } task.SearchContext = context; await _taskHandlerService.SendTask(task); }