public static async Task <IEnumerable <IEntityValue> > CreatePropertyPageValuesAsync( IQueryExecutionContext queryExecutionContext, IEntityValue parent, UnconfiguredProject project, IProjectStateProvider projectStateProvider, IPropertyPagePropertiesAvailableStatus requestedProperties) { if (await project.GetProjectLevelPropertyPagesCatalogAsync() is IPropertyPagesCatalog projectCatalog) { return(createPropertyPageValuesAsync()); } return(Enumerable.Empty <IEntityValue>()); IEnumerable <IEntityValue> createPropertyPageValuesAsync() { IProjectState projectState = projectStateProvider.CreateState(project); QueryProjectPropertiesContext propertiesContext = new QueryProjectPropertiesContext(isProjectFile: true, project.FullPath, itemType: null, itemName: null); foreach (string schemaName in projectCatalog.GetProjectLevelPropertyPagesSchemas()) { if (projectCatalog.GetSchema(schemaName) is Rule rule && !rule.PropertyPagesHidden) { IEntityValue propertyPageValue = CreatePropertyPageValue(queryExecutionContext, parent, projectState, propertiesContext, rule, requestedProperties: requestedProperties); yield return(propertyPageValue); } } } }
public static async Task <IEntityValue?> CreatePropertyPageValueAsync( IQueryExecutionContext queryExecutionContext, EntityIdentity id, IProjectService2 projectService, IProjectStateProvider projectStateProvider, QueryProjectPropertiesContext propertiesContext, string propertyPageName, IPropertyPagePropertiesAvailableStatus requestedProperties) { if (projectService.GetLoadedProject(propertiesContext.File) is UnconfiguredProject project) { project.GetQueryDataVersion(out string versionKey, out long versionNumber); queryExecutionContext.ReportInputDataVersion(versionKey, versionNumber); if (await project.GetProjectLevelPropertyPagesCatalogAsync() is IPropertyPagesCatalog projectCatalog && projectCatalog.GetSchema(propertyPageName) is Rule rule && !rule.PropertyPagesHidden) { IProjectState projectState = projectStateProvider.CreateState(project); IEntityValue propertyPageValue = CreatePropertyPageValue(queryExecutionContext, id, projectState, propertiesContext, rule, requestedProperties); return(propertyPageValue); } } return(null); }
public PropertyPageByIdDataProducer(IPropertyPagePropertiesAvailableStatus properties, IProjectService2 projectService) { Requires.NotNull(properties, nameof(properties)); Requires.NotNull(projectService, nameof(projectService)); _properties = properties; _projectService = projectService; }
public PropertyPageByIdDataProducer(IPropertyPagePropertiesAvailableStatus properties, IProjectService2 projectService, IPropertyPageQueryCacheProvider queryCacheProvider) { Requires.NotNull(properties, nameof(properties)); Requires.NotNull(projectService, nameof(projectService)); Requires.NotNull(queryCacheProvider, nameof(queryCacheProvider)); _properties = properties; _projectService = projectService; _queryCacheProvider = queryCacheProvider; }
public static async Task <IEnumerable <IEntityValue> > CreatePropertyPageValuesAsync( IQueryExecutionContext queryExecutionContext, IEntityValue parent, UnconfiguredProject project, IPropertyPagePropertiesAvailableStatus requestedProperties) { if (await project.GetProjectLevelPropertyPagesCatalogAsync() is IPropertyPagesCatalog projectCatalog) { return(createPropertyPageValuesAsync()); } return(Enumerable.Empty <IEntityValue>()); IEnumerable <IEntityValue> createPropertyPageValuesAsync() { IProjectState projectState = new PropertyPageProjectState(project); QueryProjectPropertiesContext propertiesContext = new QueryProjectPropertiesContext(isProjectFile: true, project.FullPath, itemType: null, itemName: null); foreach (string schemaName in projectCatalog.GetProjectLevelPropertyPagesSchemas()) { if (projectCatalog.GetSchema(schemaName) is Rule rule && !rule.PropertyPagesHidden) { if (rule.Name == "RazorGeneral" || rule.Name == "RazorExtension") { // Some versions of the .NET SDK include a Razor property page that appears // in the UI. This page is not intended for display. // // We cannot remove this page from existing versions of the SDK, so have to // explicitly exclude it from query results so that it doesn't appear in any // UI. continue; } IEntityValue propertyPageValue = CreatePropertyPageValue(queryExecutionContext, parent, projectState, propertiesContext, rule, requestedProperties: requestedProperties); yield return(propertyPageValue); } } } }
public PropertyPageFromProjectDataProducer(IPropertyPagePropertiesAvailableStatus properties) { _properties = properties; }
public static IEntityValue CreatePropertyPageValue(IEntityValue parent, IPropertyPageQueryCache cache, Rule rule, List <Rule>?debugChildRules, IPropertyPagePropertiesAvailableStatus requestedProperties) { Requires.NotNull(parent, nameof(parent)); Requires.NotNull(rule, nameof(rule)); string name = rule.PageTemplate == "debuggerParent" ? DebugUtilities.ConvertRealPageNameToDebugPageName(rule.Name) : rule.Name; var identity = new EntityIdentity( ((IEntityWithId)parent).Id, new KeyValuePair <string, string>[] { new(ProjectModelIdentityKeys.PropertyPageName, name) });
public PropertyPageFromProjectDataProducer(IPropertyPagePropertiesAvailableStatus properties, IPropertyPageQueryCacheProvider queryCacheProvider) { _properties = properties; _queryCacheProvider = queryCacheProvider; }
public static IEntityValue CreatePropertyPageValue(IQueryExecutionContext queryExecutionContext, EntityIdentity id, IProjectState cache, QueryProjectPropertiesContext propertiesContext, Rule rule, IPropertyPagePropertiesAvailableStatus requestedProperties) { Requires.NotNull(rule, nameof(rule)); var newPropertyPage = new PropertyPageValue(queryExecutionContext.EntityRuntime, id, new PropertyPagePropertiesAvailableStatus()); if (requestedProperties.Name) { newPropertyPage.Name = rule.Name; } if (requestedProperties.DisplayName) { newPropertyPage.DisplayName = rule.DisplayName; } if (requestedProperties.Order) { newPropertyPage.Order = rule.Order; } if (requestedProperties.Kind) { newPropertyPage.Kind = rule.PageTemplate; } ((IEntityValueFromProvider)newPropertyPage).ProviderState = new ContextAndRuleProviderState(cache, propertiesContext, rule); return(newPropertyPage); }
public static IEntityValue CreatePropertyPageValue(IQueryExecutionContext queryExecutionContext, IEntityValue parent, IProjectState cache, QueryProjectPropertiesContext propertiesContext, Rule rule, IPropertyPagePropertiesAvailableStatus requestedProperties) { Requires.NotNull(parent, nameof(parent)); Requires.NotNull(rule, nameof(rule)); var identity = new EntityIdentity( ((IEntityWithId)parent).Id, createKeys()); return(CreatePropertyPageValue(queryExecutionContext, identity, cache, propertiesContext, rule, requestedProperties)); IEnumerable <KeyValuePair <string, string> > createKeys() { yield return(new(ProjectModelIdentityKeys.PropertyPageName, rule.Name)); if (propertiesContext.ItemType is not null) { yield return(new(ProjectModelIdentityKeys.SourceItemType, propertiesContext.ItemType)); } if (propertiesContext.ItemName is not null) { yield return(new(ProjectModelIdentityKeys.SourceItemName, propertiesContext.ItemName)); } } }
public static IEntityValue CreatePropertyPageValue(IEntityValue parent, IPropertyPageQueryCache cache, Rule rule, IPropertyPagePropertiesAvailableStatus requestedProperties) { Requires.NotNull(parent, nameof(parent)); Requires.NotNull(rule, nameof(rule)); var identity = new EntityIdentity( ((IEntityWithId)parent).Id, new KeyValuePair <string, string>[] { new(ProjectModelIdentityKeys.PropertyPageName, rule.Name) });
public PropertyPageFromProjectDataProducer(IPropertyPagePropertiesAvailableStatus properties, IProjectStateProvider projectStateProvider) { _properties = properties; _projectStateProvider = projectStateProvider; }