コード例 #1
0
        internal static SqlIntegratedChangeTrackingPolicy DeserializeSqlIntegratedChangeTrackingPolicy(JsonElement element)
        {
            SqlIntegratedChangeTrackingPolicy result = new SqlIntegratedChangeTrackingPolicy();

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("@odata.type"))
                {
                    result.ODataType = property.Value.GetString();
                    continue;
                }
            }
            return(result);
        }
        internal static DataChangeDetectionPolicy DeserializeDataChangeDetectionPolicy(JsonElement element)
        {
            if (element.TryGetProperty("@odata.type", out JsonElement discriminator))
            {
                switch (discriminator.GetString())
                {
                case "#Microsoft.Azure.Search.HighWaterMarkChangeDetectionPolicy": return(HighWaterMarkChangeDetectionPolicy.DeserializeHighWaterMarkChangeDetectionPolicy(element));

                case "#Microsoft.Azure.Search.SqlIntegratedChangeTrackingPolicy": return(SqlIntegratedChangeTrackingPolicy.DeserializeSqlIntegratedChangeTrackingPolicy(element));
                }
            }
            DataChangeDetectionPolicy result = new DataChangeDetectionPolicy();

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("@odata.type"))
                {
                    result.ODataType = property.Value.GetString();
                    continue;
                }
            }
            return(result);
        }