public static LogicalDatabaseCache Parse([NotNull] string name, [NotNull] string fallbackSettingName, [CanBeNull] XmlNode definition, ISitecoreVersion version)
        {
            if (definition == null)
            {
                return(new LogicalDatabaseCache(name, fallbackSettingName, null));
            }

            var size  = CacheSize.Parse(definition.InnerText, version);
            var cache = new LogicalDatabaseCache(name, fallbackSettingName, size, definition);

            return(cache);
        }
Beispiel #2
0
        public static LogicalDatabaseDefinition Parse([NotNull] XmlElement definition, ISitecoreVersion version)
        {
            Assert.ArgumentNotNull(definition, nameof(definition));

            var name = definition.GetAttribute("id");

            Assert.ArgumentCondition(!string.IsNullOrWhiteSpace(name), nameof(definition), $"The id attribute is missing or whitespace.\r\nXml: {definition.OuterXml}");

            var caches = CacheDefinitions.Values
                         .Select(x => new { x.Name, x.FallbackSizeSettingName, Definition = definition.SelectSingleNode(x.XPath) })
                         .ToMap(x => x.Name, x => LogicalDatabaseCache.Parse(x.Name, x.FallbackSizeSettingName, x.Definition, version));

            return(new LogicalDatabaseDefinition(name, caches, definition));
        }