Beispiel #1
0
        public static async Task <IEnumerable <IEntityValue> > CreateUIPropertyValueValuesAsync(
            IEntityValue parent,
            IPropertyPageQueryCache cache,
            Rule schema,
            string propertyName,
            IUIPropertyValuePropertiesAvailableStatus requestedProperties)
        {
            ImmutableList <IEntityValue> .Builder builder = ImmutableList.CreateBuilder <IEntityValue>();

            if (await cache.GetKnownConfigurationsAsync() is IImmutableSet <ProjectConfiguration> knownConfigurations)
            {
                foreach (ProjectConfiguration knownConfiguration in knownConfigurations)
                {
                    if (await cache.BindToRule(knownConfiguration, schema.Name) is IRule rule &&
                        rule.GetProperty(propertyName) is ProjectSystem.Properties.IProperty property)
                    {
                        IEntityValue propertyValue = await CreateUIPropertyValueValueAsync(parent, knownConfiguration, property, requestedProperties);

                        builder.Add(propertyValue);
                    }
                }
            }

            return(builder.ToImmutable());
        }
Beispiel #2
0
        internal static IPropertyPageQueryCacheProvider Create(IPropertyPageQueryCache cache)
        {
            var mock = new Mock <IPropertyPageQueryCacheProvider>();

            mock.Setup(f => f.CreateCache(It.IsAny <UnconfiguredProject>())).Returns(cache);

            return(mock.Object);
        }
        public static IEntityValue CreateUIPropertyValue(IEntityValue parent, IPropertyPageQueryCache cache, BaseProperty property, int order, IUIPropertyPropertiesAvailableStatus requestedProperties)
        {
            Requires.NotNull(parent, nameof(parent));
            Requires.NotNull(property, nameof(property));

            var identity = new EntityIdentity(
                ((IEntityWithId)parent).Id,
                new KeyValuePair <string, string>[]
            {
                new(ProjectModelIdentityKeys.UIPropertyName, property.Name)
            });
        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 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)
            });
Beispiel #6
0
        public static async Task <IEnumerable <IEntityValue> > CreateUIPropertyValueValuesAsync(
            IEntityValue parent,
            IPropertyPageQueryCache cache,
            Rule schema,
            string propertyName,
            IUIPropertyValuePropertiesAvailableStatus requestedProperties)
        {
            BaseProperty?unboundProperty = schema.GetProperty(propertyName);

            if (unboundProperty is null)
            {
                return(ImmutableList <IEntityValue> .Empty);
            }

            ImmutableList <IEntityValue> .Builder builder = ImmutableList.CreateBuilder <IEntityValue>();

            IEnumerable <ProjectConfiguration> configurations;

            if (unboundProperty.IsConfigurationDependent())
            {
                // Return the values across all configurations.
                configurations = await cache.GetKnownConfigurationsAsync() ?? Enumerable.Empty <ProjectConfiguration>();
            }
            else
            {
                // Return the value from any one configuration.
                if (await cache.GetSuggestedConfigurationAsync() is ProjectConfiguration defaultConfiguration)
                {
                    configurations = CreateSingleItemEnumerable(defaultConfiguration);
                }
                else
                {
                    configurations = Enumerable.Empty <ProjectConfiguration>();
                }
            }

            foreach (ProjectConfiguration configuration in configurations)
            {
                if (await cache.BindToRule(configuration, schema.Name) is IRule rule &&
                    rule.GetProperty(propertyName) is ProjectSystem.Properties.IProperty property)
                {
                    IEntityValue propertyValue = await CreateUIPropertyValueValueAsync(parent, configuration, property, requestedProperties);

                    builder.Add(propertyValue);
                }
            }

            return(builder.ToImmutable());
 public PropertyPageProviderState(IPropertyPageQueryCache cache, Rule rule)
 {
     Cache = cache;
     Rule  = rule;
 }
Beispiel #8
0
 public PropertyPageProviderState(IPropertyPageQueryCache cache, Rule rule, List <Rule> debugChildRules)
 {
     Cache           = cache;
     Rule            = rule;
     DebugChildRules = debugChildRules;
 }
Beispiel #9
0
 public PropertyPageProviderState(IPropertyPageQueryCache cache, Rule rule)
     : this(cache, rule, new List <Rule>(capacity : 0))
 {
 }
Beispiel #10
0
 public PropertyProviderState(IPropertyPageQueryCache cache, Rule containingRule, string propertyName)
 {
     Cache          = cache;
     ContainingRule = containingRule;
     PropertyName   = propertyName;
 }