public async Task WhenThePropertyIsConfigurationIndependent_ThenOnlyOneValueIsReturned() { var parent = IEntityWithIdFactory.Create(key: "ParentName", value: "Aardvark"); var defaultConfiguration = ProjectConfigurationFactory.Create("Alpha|Beta"); var otherConfiguration = ProjectConfigurationFactory.Create("Delta|Gamma"); var cache = IPropertyPageQueryCacheFactory.Create( projectConfigurations: ImmutableHashSet <ProjectConfiguration> .Empty.Add(defaultConfiguration).Add(otherConfiguration), defaultConfiguration: defaultConfiguration, bindToRule: (config, schemaName) => IRuleFactory.Create( name: "ParentName", properties: new[] { IPropertyFactory.Create("MyProperty") })); var schema = new Rule { Properties = { new TestProperty { Name = "MyProperty", DataSource = new(){ HasConfigurationCondition = false } } } }; var propertyName = "MyProperty"; var requestedProperties = PropertiesAvailableStatusFactory.CreateUIPropertyValuePropertiesAvailableStatus(); var results = await UIPropertyValueDataProducer.CreateUIPropertyValueValuesAsync( parent, cache, schema, propertyName, requestedProperties); Assert.Single(results); }
public async Task SendRequestAsync(QueryProcessRequest <IEntityValue> request) { if ((request.RequestData as IEntityValueFromProvider)?.ProviderState is (IPropertyPageQueryCache cache, Rule schema, string propertyName)) { try { IEnumerable <IEntityValue> propertyValues = await UIPropertyValueDataProducer.CreateUIPropertyValueValuesAsync( request.RequestData, cache, schema, propertyName, _properties); foreach (IEntityValue propertyValue in propertyValues) { await ResultReceiver.ReceiveResultAsync(new QueryProcessResult <IEntityValue>(propertyValue, request, ProjectModelZones.Cps)); } } catch (Exception ex) { request.QueryExecutionContext.ReportError(ex); } } await ResultReceiver.OnRequestProcessFinishedAsync(request); }
protected override Task <IEnumerable <IEntityValue> > CreateValuesAsync(IEntityValue parent, PropertyProviderState providerState) { return(UIPropertyValueDataProducer.CreateUIPropertyValueValuesAsync( parent, providerState.Cache, providerState.ContainingRule, providerState.PropertyName, _properties)); }
protected override Task <IEnumerable <IEntityValue> > CreateValuesAsync(IQueryExecutionContext queryExecutionContext, IEntityValue parent, PropertyProviderState providerState) { return(UIPropertyValueDataProducer.CreateUIPropertyValueValuesAsync( queryExecutionContext, parent, providerState.ProjectState, providerState.ContainingRule, providerState.PropertiesContext, providerState.PropertyName, _properties)); }
protected override Task <IEnumerable <IEntityValue> > CreateValuesAsync(IQueryExecutionContext queryExecutionContext, IEntityValue parent, PropertyProviderState providerState) { (string versionKey, long versionNumber) = providerState.ProjectState.GetUnconfiguredProjectVersion(); queryExecutionContext.ReportInputDataVersion(versionKey, versionNumber); return(UIPropertyValueDataProducer.CreateUIPropertyValueValuesAsync( queryExecutionContext, parent, providerState.ProjectState, providerState.ContainingRule, providerState.PropertiesContext, providerState.PropertyName, _properties)); }