Exemplo n.º 1
0
        private static void Enrich(IField field, ContentFieldData fieldData, string partitionKey)
        {
            var defaultValue = DefaultValueFactory.CreateDefaultValue(field, SystemClock.Instance.GetCurrentInstant(), partitionKey);

            if (field.RawProperties.IsRequired || defaultValue == null || defaultValue.Type == JsonValueType.Null)
            {
                return;
            }

            if (!fieldData.TryGetValue(partitionKey, out _))
            {
                fieldData.AddLocalized(partitionKey, defaultValue);
            }
        }
Exemplo n.º 2
0
        private static void Enrich(IField field, ContentFieldData fieldData, string partitionKey)
        {
            Guard.NotNull(fieldData, nameof(fieldData));

            var defaultValue = DefaultValueFactory.CreateDefaultValue(field, SystemClock.Instance.GetCurrentInstant());

            if (field.RawProperties.IsRequired || defaultValue == null || defaultValue.Type == JsonValueType.Null)
            {
                return;
            }

            if (!fieldData.TryGetValue(partitionKey, out var value) || ShouldApplyDefaultValue(field, value))
            {
                fieldData.AddJsonValue(partitionKey, defaultValue);
            }
        }