Пример #1
0
        internal static ContainerItemInternal DeserializeContainerItemInternal(XElement element)
        {
            string name    = default;
            bool?  deleted = default;
            string version = default;
            ContainerPropertiesInternal          properties = default;
            IReadOnlyDictionary <string, string> metadata   = default;

            if (element.Element("Name") is XElement nameElement)
            {
                name = (string)nameElement;
            }
            if (element.Element("Deleted") is XElement deletedElement)
            {
                deleted = (bool?)deletedElement;
            }
            if (element.Element("Version") is XElement versionElement)
            {
                version = (string)versionElement;
            }
            if (element.Element("Properties") is XElement propertiesElement)
            {
                properties = ContainerPropertiesInternal.DeserializeContainerPropertiesInternal(propertiesElement);
            }
            if (element.Element("Metadata") is XElement metadataElement)
            {
                var dictionary = new Dictionary <string, string>();
                foreach (var e in metadataElement.Elements())
                {
                    dictionary.Add(e.Name.LocalName, (string)e);
                }
                metadata = dictionary;
            }
            return(new ContainerItemInternal(name, deleted, version, properties, metadata));
        }
Пример #2
0
 internal ContainerItemInternal(string name, bool?deleted, string version, ContainerPropertiesInternal properties, IReadOnlyDictionary <string, string> metadata)
 {
     Name       = name;
     Deleted    = deleted;
     Version    = version;
     Properties = properties;
     Metadata   = metadata;
 }
Пример #3
0
        internal ContainerItemInternal(string name, ContainerPropertiesInternal properties)
        {
            if (name == null)
            {
                throw new ArgumentNullException(nameof(name));
            }
            if (properties == null)
            {
                throw new ArgumentNullException(nameof(properties));
            }

            Name       = name;
            Properties = properties;
            Metadata   = new ChangeTrackingDictionary <string, string>();
        }