protected override Task <IEntityValue?> TryCreateEntityOrNullAsync(IQueryExecutionContext queryExecutionContext, EntityIdentity id)
        {
            if (QueryProjectPropertiesContext.TryCreateFromEntityId(id, out QueryProjectPropertiesContext? propertiesContext) &&
                id.TryGetValue(ProjectModelIdentityKeys.PropertyPageName, out string?propertyPageName) &&
                id.TryGetValue(ProjectModelIdentityKeys.UIPropertyName, out string?propertyName))
            {
                return(UIPropertyDataProducer.CreateUIPropertyValueAsync(
                           queryExecutionContext,
                           id,
                           _projectService,
                           propertiesContext,
                           propertyPageName,
                           propertyName,
                           _properties));
            }

            return(NullEntityValue);
        }
Exemplo n.º 2
0
        protected override Task <IEntityValue?> TryCreateEntityOrNullAsync(IEntityRuntimeModel runtimeModel, EntityIdentity id)
        {
            if (id.KeysCount == 3 &&
                id.TryGetValue(ProjectModelIdentityKeys.ProjectPath, out string projectPath) &&
                id.TryGetValue(ProjectModelIdentityKeys.PropertyPageName, out string propertyPageName) &&
                id.TryGetValue(ProjectModelIdentityKeys.UIPropertyName, out string propertyName))
            {
                return(UIPropertyDataProducer.CreateUIPropertyValueAsync(
                           runtimeModel,
                           id,
                           _projectService,
                           _queryCacheProvider,
                           projectPath,
                           propertyPageName,
                           propertyName,
                           _properties));
            }

            return(NullEntityValue);
        }
Exemplo n.º 3
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 path) &&
                    requestId.TryGetValue(ProjectModelIdentityKeys.PropertyPageName, out string propertyPageName) &&
                    requestId.TryGetValue(ProjectModelIdentityKeys.UIPropertyName, out string propertyName))
                {
                    try
                    {
                        IEntityValue?propertyValue = await UIPropertyDataProducer.CreateUIPropertyValueAsync(
                            request.QueryExecutionContext.EntityRuntime,
                            requestId,
                            _projectService,
                            _queryCacheProvider,
                            path,
                            propertyPageName,
                            propertyName,
                            _properties);

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

            await ResultReceiver.OnRequestProcessFinishedAsync(request);
        }