/// <summary> /// Validates that <paramref name="id"/> represents a launch profile (or a child /// entity of a launch profile) and throws if it does not. Returns the profile name. /// </summary> /// <remarks> /// We expect that the Project Query engine will only give us entities and entity /// IDs that we know how to handle, as specified by the metadata on our /// implementations of <see cref="IQueryByIdDataProvider"/> and <see cref="IQueryByRelationshipDataProvider"/>. /// Anything else warrants an exception. /// </remarks> private static string ValidateIdAndExtractProfileName(EntityIdentity id) { Assumes.True(id.TryGetValue(ProjectModelIdentityKeys.SourceItemType, out string?type)); Assumes.True(StringComparers.ItemTypes.Equals(type, s_launchProfileSourceItemTypeValue)); Assumes.True(id.TryGetValue(ProjectModelIdentityKeys.SourceItemName, out string?name)); return(name); }
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); }
protected override Task <IEntityValue?> TryCreateEntityOrNullAsync(IEntityRuntimeModel runtimeModel, EntityIdentity id) { if (id.KeysCount == 2 && id.TryGetValue(ProjectModelIdentityKeys.ProjectPath, out string projectPath) && id.TryGetValue(ProjectModelIdentityKeys.PropertyPageName, out string propertyPageName)) { return(PropertyPageDataProducer.CreatePropertyPageValueAsync( runtimeModel, id, _projectService, _queryCacheProvider, projectPath, propertyPageName, _properties)); } return(NullEntityValue); }
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); }
protected override Task <IEntityValue?> TryCreateEntityOrNullAsync(IEntityRuntimeModel runtimeModel, 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( runtimeModel, id, _projectService, projectPath, propertyPageName, propertyName, editorName, _properties)); } return(NullEntityValue); }
private static string ValidateIdAndExtractProjectPath(EntityIdentity id) { Assumes.True(id.TryGetValue(ProjectModelIdentityKeys.ProjectPath, out string?projectPath)); return(projectPath); }