I have created a asp.net core 2.0 web app on which you can query an azure table on Partitionkey and 2 double fields (rating and temperature). The Table storage is updated 4 times a day in another process using a python script. Once in a while the script writes a few empty double fields in the table. Unfortunately, the Table query throws an exception: "Unexpected EDM type from the Table Service: Edm.Double.Unexpected EDM type from the Table Service: Edm.Double."
This is the code i use to Query the table:
//filters
string datefilter = (TableQuery.GenerateFilterCondition("PartitionKey", QueryComparisons.Equal, date));
string ratingfilter = (TableQuery.GenerateFilterConditionForDouble(RatingColumn, QueryComparisons.GreaterThanOrEqual, Rating));
string tempfilter = (TableQuery.GenerateFilterConditionForDouble(TempColumn, QueryComparisons.GreaterThanOrEqual, Temp));
//query
TableQuery<RatingsEntity> query =
new TableQuery<RatingsEntity>()
.Where(TableQuery.CombineFilters(
TableQuery.CombineFilters(
datefilter, TableOperators.And, ratingfilter),
TableOperators.And, tempfilter)
);
List<RatingsEntity> ratings = new List<RatingsEntity>();
TableContinuationToken token = null;
do
{
TableQuerySegment<RatingsEntity> resultSegment = await ratingTable.ExecuteQuerySegmentedAsync(query, token);
token = resultSegment.ContinuationToken;
foreach (RatingsEntity rating in resultSegment.Results)
{
ratings.Add(rating);
}
} while (token != null);
if (ratings.Count == 0)
{
return View("~/Views/Home/NotFound.cshtml");
}
else ....
My entity looks like this:
public class RatingsEntity : TableEntity
{
public RatingsEntity(string ratingdate, string latlon) {
this.PartitionKey = ratingdate;
this.RowKey = latlon;
}
public RatingsEntity() { }
public double avgmaxtemp16 { get; set; }
public double avgmaxtemp7 { get; set; }...
As far as i can understand, at some point the process that maps the queryresult to the entity fails because the type is not double, but something else, e.g. string. (Storage explorer shows an empty double type). I have tried to make the doubles nullable, but without succes. I've looked at the TableRequestOptions Class, Which has a IsNull() method, but i don't see how to implement that, and if that would work at all..