Example #1
0
        internal static ApplicationDefinitionArtifact DeserializeApplicationDefinitionArtifact(JsonElement element)
        {
            ApplicationDefinitionArtifactName name = default;
            Uri uri = default;
            ApplicationArtifactType type = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("name"))
                {
                    name = new ApplicationDefinitionArtifactName(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("uri"))
                {
                    uri = new Uri(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("type"))
                {
                    type = property.Value.GetString().ToApplicationArtifactType();
                    continue;
                }
            }
            return(new ApplicationDefinitionArtifact(name, uri, type));
        }
        public ApplicationDefinitionArtifact(ApplicationDefinitionArtifactName name, string uri, ApplicationArtifactType type)
        {
            if (uri == null)
            {
                throw new ArgumentNullException(nameof(uri));
            }

            Name = name;
            Uri  = uri;
            Type = type;
        }