나는 deviceid, timestamp 및 pm1을 저장하는 테이블 저장소를 가지고 있습니다. 특정 장치 ID 및 특정 시간 범위 사이에있는 엔티티에 액세스하기 위해 C#을 사용하려고합니다. 내가 원하는 엔티티를 얻을 수 있었지만이 엔티티에 대한 pm1 판독 값은 올바르지 않은 0입니다. pm1 판독 값은 테이블 저장 영역에 없습니다. 어떻게 해결할 수 있을까요? 내가 원하는 결과 여기C#을 통해 액세스되는 테이블 저장소의 엔터티 속성 값이 0입니다.
[2017-11-08 5:25:59 PM] C# All the entities in current event: HAVEN-0D0E0A-TZ-000115, 2017-10-25 2:42:00 AM, 0
[2017-11-08 5:25:59 PM] C# All the entities in current event: HAVEN-0D0E0A-TZ-000115, 2017-10-25 2:45:00 AM, 0
[2017-11-08 5:25:59 PM] C# All the entities in current event: HAVEN-0D0E0A-TZ-000115, 2017-10-25 2:51:00 AM, 0
[2017-11-08 5:25:59 PM] C# All the entities in current event: HAVEN-0D0E0A-TZ-000115, 2017-10-25 2:54:00 AM, 0
[2017-11-08 5:25:59 PM] C# All the entities in current event: HAVEN-0D0E0A-TZ-000115, 2017-10-25 2:57:00 AM, 0
[2017-11-08 5:25:59 PM] C# All the entities in current event: HAVEN-0D0E0A-TZ-000115, 2017-10-25 3:00:00 AM, 0
[2017-11-08 5:25:59 PM] C# All the entities in current event: HAVEN-0D0E0A-TZ-000115, 2017-10-25 3:03:00 AM, 0
[2017-11-08 5:25:59 PM] C# All the entities in current event: HAVEN-0D0E0A-TZ-000115, 2017-10-25 3:06:00 AM, 0
[2017-11-08 5:25:59 PM] C# All the entities in current event: HAVEN-0D0E0A-TZ-000115, 2017-10-25 3:09:00 AM, 0
[2017-11-08 5:25:59 PM] C# All the entities in current event: HAVEN-0D0E0A-TZ-000115, 2017-10-25 3:12:00 AM, 0
[2017-11-08 5:25:59 PM] C# All the entities in current event: HAVEN-0D0E0A-TZ-000115, 2017-10-25 3:15:00 AM, 0
[2017-11-08 5:25:59 PM] C# All the entities in current event: HAVEN-0D0E0A-TZ-000115, 2017-10-25 3:18:00 AM, 0
됩니다 : 당신이 반환 pm1con을 볼 수 있습니다 그래서
여기main():
string partitionFilter = TableQuery.GenerateFilterCondition("deviceid", QueryComparisons.Equal, StartEntity.deviceid);
string date1 = TableQuery.GenerateFilterConditionForDate("ts", QueryComparisons.GreaterThanOrEqual,starttime);
string date2 = TableQuery.GenerateFilterConditionForDate("ts", QueryComparisons.LessThanOrEqual, endtime);
string datefilter = TableQuery.CombineFilters(date1, TableOperators.And, date2);
string pm1con = TableQuery.GenerateFilterConditionForInt("pm1con", QueryComparisons.GreaterThan, 0);
string finalFilter = TableQuery.CombineFilters(partitionFilter,TableOperators.And, datefilter);
string extrafilter = TableQuery.CombineFilters(finalFilter, TableOperators.And, pm1con);
TableQuery<EventEntity> RangeQueryforEnentEntities = new TableQuery<EventEntity>().Where(extrafilter);
TableContinuationToken token = null;
do
{
TableQuerySegment<EventEntity> resultSegment = EventsTable.ExecuteQuerySegmented(RangeQueryforEnentEntities, token);
token = resultSegment.ContinuationToken;
foreach (EventEntity entity in resultSegment.Results)
{
EventEntities.Add(entity);
log.Info($"C# All the entities in current event: {entity.deviceid}, {entity.ts}, {entity.PM1Con}");
}
} while (token != null);
return EventEntities;
public class EventEntity : TableEntity
{
public EventEntity(string deviceid, DateTime ts, int PM1Con, float TumblingB_threshold, float TumblingB_confidence)
{
this.PartitionKey = deviceid;
this.RowKey = ts.ToLongDateString();
}
public EventEntity() { }
public string deviceid { get; set; }
public DateTime ts { get; set; }
public float pm1con { get; set; }
public float TumblingB_threshold { get; set; }
public float TumblingB_confidence { get; set; }
}
반환 된 결과입니다 : 여기
내 코드입니다 가치가 잘못되었습니다.
문제 해결을 위해 소스 코드의 일부를 공유하십시오. 문제를 설명하기에 설명이 충분하지 않다고 생각합니다. –
@ ZhaoxingLu-Microsoft 질문이 편집되었습니다. 제발 봐봐 –