internal static ApplicationArtifact DeserializeApplicationArtifact(JsonElement element)
        {
            ApplicationArtifactName name = default;
            string uri = default;
            ApplicationArtifactType type = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("name"))
                {
                    name = new ApplicationArtifactName(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("uri"))
                {
                    uri = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("type"))
                {
                    type = property.Value.GetString().ToApplicationArtifactType();
                    continue;
                }
            }
            return(new ApplicationArtifact(name, uri, type));
        }
Ejemplo n.º 2
0
        internal ApplicationArtifact(ApplicationArtifactName name, Uri uri, ApplicationArtifactType applicationArtifactType)
        {
            if (uri == null)
            {
                throw new ArgumentNullException(nameof(uri));
            }

            Name = name;
            Uri  = uri;
            ApplicationArtifactType = applicationArtifactType;
        }