Exemplo n.º 1
0
 internal DataSource(string name, string description, DataSourceType type, DataSourceCredentials credentials, DataContainer container, DataChangeDetectionPolicy dataChangeDetectionPolicy, DataDeletionDetectionPolicy dataDeletionDetectionPolicy, string eTag)
 {
     Name        = name;
     Description = description;
     Type        = type;
     Credentials = credentials;
     Container   = container;
     DataChangeDetectionPolicy   = dataChangeDetectionPolicy;
     DataDeletionDetectionPolicy = dataDeletionDetectionPolicy;
     ETag = eTag;
 }
Exemplo n.º 2
0
        internal static DataSource DeserializeDataSource(JsonElement element)
        {
            string                      name        = default;
            string                      description = default;
            DataSourceType              type        = default;
            DataSourceCredentials       credentials = default;
            DataContainer               container   = default;
            DataChangeDetectionPolicy   dataChangeDetectionPolicy   = default;
            DataDeletionDetectionPolicy dataDeletionDetectionPolicy = default;
            string                      odataEtag = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("description"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    description = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("type"))
                {
                    type = new DataSourceType(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("credentials"))
                {
                    credentials = DataSourceCredentials.DeserializeDataSourceCredentials(property.Value);
                    continue;
                }
                if (property.NameEquals("container"))
                {
                    container = DataContainer.DeserializeDataContainer(property.Value);
                    continue;
                }
                if (property.NameEquals("dataChangeDetectionPolicy"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    dataChangeDetectionPolicy = DataChangeDetectionPolicy.DeserializeDataChangeDetectionPolicy(property.Value);
                    continue;
                }
                if (property.NameEquals("dataDeletionDetectionPolicy"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    dataDeletionDetectionPolicy = DataDeletionDetectionPolicy.DeserializeDataDeletionDetectionPolicy(property.Value);
                    continue;
                }
                if (property.NameEquals("@odata.etag"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    odataEtag = property.Value.GetString();
                    continue;
                }
            }
            return(new DataSource(name, description, type, credentials, container, dataChangeDetectionPolicy, dataDeletionDetectionPolicy, odataEtag));
        }