예제 #1
0
        protected override Task <IEntityValue?> TryCreateEntityOrNullAsync(IQueryExecutionContext queryExecutionContext, EntityIdentity id)
        {
            if (id.KeysCount == 4 &&
                id.TryGetValue(ProjectModelIdentityKeys.ProjectPath, out string projectPath) &&
                id.TryGetValue(ProjectModelIdentityKeys.PropertyPageName, out string propertyPageName) &&
                id.TryGetValue(ProjectModelIdentityKeys.UIPropertyName, out string propertyName) &&
                id.TryGetValue(ProjectModelIdentityKeys.EditorName, out string editorName))
            {
                return(UIPropertyEditorDataProducer.CreateEditorValueAsync(
                           queryExecutionContext,
                           id,
                           _projectService,
                           projectPath,
                           propertyPageName,
                           propertyName,
                           editorName,
                           _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 == 4 &&
                    requestId.TryGetValue(ProjectModelIdentityKeys.ProjectPath, out string path) &&
                    requestId.TryGetValue(ProjectModelIdentityKeys.PropertyPageName, out string propertyPageName) &&
                    requestId.TryGetValue(ProjectModelIdentityKeys.UIPropertyName, out string propertyName) &&
                    requestId.TryGetValue(ProjectModelIdentityKeys.EditorName, out string editorName))
                {
                    try
                    {
                        IEntityValue?propertyEditor = await UIPropertyEditorDataProducer.CreateEditorValueAsync(
                            request.QueryExecutionContext.EntityRuntime,
                            requestId,
                            _projectService,
                            path,
                            propertyPageName,
                            propertyName,
                            editorName,
                            _properties);

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

            await ResultReceiver.OnRequestProcessFinishedAsync(request);
        }