Пример #1
0
        protected override Task <IEntityValue?> TryCreateEntityOrNullAsync(IQueryExecutionContext queryExecutionContext, EntityIdentity id)
        {
            if (id.KeysCount == 3 &&
                id.TryGetValue(ProjectModelIdentityKeys.ProjectPath, out string?projectPath) &&
                id.TryGetValue(ProjectModelIdentityKeys.PropertyPageName, out string?propertyPageName) &&
                id.TryGetValue(ProjectModelIdentityKeys.CategoryName, out string?categoryName))
            {
                return(CategoryDataProducer.CreateCategoryValueAsync(
                           queryExecutionContext,
                           id,
                           _projectService,
                           projectPath,
                           propertyPageName,
                           categoryName,
                           _properties));
            }

            return(NullEntityValue);
        }
Пример #2
0
        public async Task SendRequestAsync(QueryProcessRequest <IReadOnlyCollection <EntityIdentity> > request)
        {
            Requires.NotNull(request, nameof(request));

            foreach (EntityIdentity requestId in request.RequestData)
            {
                if (requestId.KeysCount == 3 &&
                    requestId.TryGetValue(ProjectModelIdentityKeys.ProjectPath, out string projectPath) &&
                    requestId.TryGetValue(ProjectModelIdentityKeys.PropertyPageName, out string propertyPageName) &&
                    requestId.TryGetValue(ProjectModelIdentityKeys.CategoryName, out string categoryName))
                {
                    try
                    {
                        IEntityValue?categoryValue = await CategoryDataProducer.CreateCategoryValueAsync(
                            request.QueryExecutionContext.EntityRuntime,
                            requestId,
                            _projectService,
                            projectPath,
                            propertyPageName,
                            categoryName,
                            _properties);

                        if (categoryValue != null)
                        {
                            await ResultReceiver.ReceiveResultAsync(new QueryProcessResult <IEntityValue>(categoryValue, request, ProjectModelZones.Cps));
                        }
                    }
                    catch (Exception ex)
                    {
                        request.QueryExecutionContext.ReportError(ex);
                    }
                }
            }

            await ResultReceiver.OnRequestProcessFinishedAsync(request);
        }