Запрос хранения таблицы не заполняет все поля - PullRequest
0 голосов
/ 14 января 2020

Я пытаюсь запросить TableStorage с помощью следующего метода:

    public async Task<List<T>> RetrieveEntityAsync<T>(string deviceId) where T : TableEntity, new()
    {
        try
        {
            TableQuery<T> DataTableQuery = new TableQuery<T>();
            if (!string.IsNullOrEmpty(deviceId))
            {
               var filter = TableQuery.GenerateFilterCondition("PartitionKey", QueryComparisons.Equal, deviceId);
               DataTableQuery = new TableQuery<T>().Where(filter);
            }

            var l = new List<T>();
            TableContinuationToken continuationToken = null;
            do
            {
                var queryResponse = await table.ExecuteQuerySegmentedAsync(DataTableQuery, continuationToken);
                continuationToken = queryResponse.ContinuationToken;
                l.AddRange(queryResponse.Results);
            }
            while (continuationToken != null);
            return l;
        }
        catch (Exception ExceptionObj)
        {
            throw ExceptionObj;
        }
    }

, вызывающего его следующим образом:

    List<TelemetryTS> elements = await tabeManager.RetrieveEntityAsync<TelemetryTS>(dto.DeviceIdorId);

TelemetryTS объявляется следующим образом:

public class TelemetryTS : TableEntity
{

    public TelemetryTS() { }

    public TelemetryTS(string partitionKey, string rowKey)
    {
        this.PartitionKey = partitionKey;
        this.RowKey = rowKey;
    }


    public double AIn { get; set; }
    public double AOut { get; set; }
    public double CosPhi { get; set; }
    public double H { get; set; }
    public string L { get; set; }
    public DateTime MeterTS { get; set; }
    public Int64 PartitionId { get; set; }
    public Int64 Sampling { get; set; }
    public Int64 UTC { get; set; }
    public double VA { get; set; }
    public double VIn { get; set; }
    public double VOut { get; set; }
    public double Var { get; set; }
    public Int64 VarSCnt { get; set; }
    public double Varh { get; set; }
    public double W { get; set; }
    public Int64 WSCnt { get; set; }
    public double Wh { get; set; }
    public double cIn { get; set; }
    public double cOut { get; set; }
    public string deviceId { get; set; }
    public double kVar { get; set; }
    public double kVarH { get; set; }
    public double kW { get; set; }
    public double kWh { get; set; }
    public string mts { get; set; }
    public Int64 nDips { get; set; }
    public Int64 nSwells { get; set; }
    public Int64 tDips { get; set; }
    public Int64 tSlot { get; set; }
    public Int64 tSwells { get; set; }

    public double MaxPotenzaAttiva { get; set; }
    public double MaxTensioneIngresso { get; set; }
    public double MaxPotenzaReattiva { get; set; }
    public double MaxCorrenteIngresso { get; set; }
    public double AvgPotenzaAttiva { get; set; }
    public double AvgTensioneIngresso { get; set; }
    public double AvgPotenzaReattiva { get; set; }
    public double AvgCorrenteIngresso { get; set; }

    public double WhConsumoUltimoGiorno { get; set; }
    public double WhPercRispUltimoGiorno { get; set; }
    public double WhConsumoUltimaSettimana { get; set; }
    public double WhPercRispUltimaSettimana { get; set; }
    public double WhConsumoUltimoMese { get; set; }
    public double WhPercRispUltimoMese { get; set; }

    public double AvgRispDaEfficenzaUltimoGiorno { get; set; }
    public double AvgRispDaEfficienzaUltimaSettimana { get; set; }
    public double AvgRispDaEfficienzaUltimoMese { get; set; }

    public string IoTHubError { get; set; }

    public int severity { get; set; }

}

Количество возвращаемых записей является правильным, но в отдельных записях не все поля заполнены, как показано в StorageExplorer. Например, поля DateTime не получены правильно.

В чем может быть проблема?

Спасибо за помощь

...