Closed fuzzzerd closed 4 years ago
What's your sdk version, can you please share repro code snippet?
This is the same known issue as the post referenced. The proposed fix was never merged into master. We will re-triage this bug during the next release. If your Model class can extend TableEntity, the missing property scenario is handled properly.
What's your sdk version,
.NET Core v3.1.100
can you please share repro code snippet?
Yes, I'm using a TableEntityAdapter
and not inheriting TableEntity.
public class DataModel // poco, currently not using TableEntity
{
public string Name { get; set; }
// an so on
}
public class DataModelAdapter : TableEntityAdapter<DataModel>
{
public DataModelAdapter() { }
public DataModelAdapter(string partitionKey, DataModel model) : base(model)
{
this.PartitionKey = BuildPartitionKey(partitionKey);
this.RowKey = model.Name
}
public static string BuildPartitionKey(string partitionKey)
{
return $"{partitionKey}";
}
}
// simple case, just query by partition and row key, the query does not seem to impact the result
var partitionKeyFilter = TableQuery.CombineFilters(
TableQuery.GenerateFilterCondition("PartitionKey", QueryComparisons.Equal, partitionKey),
TableOperators.And,
TableQuery.GenerateFilterCondition("RowKey", QueryComparisons.Equal, rowKey)
);
var query = new TableQuery<DataModelAdapter>().Where(partitionKeyFilter);
var results = await _table.ExecuteQuerySegmentedAsync(query, null);
In this case, if the underlying Azure Table has only one field called Name
everything works fine; however, as mentioned if another field is added to the table, this calling code blows up unless DataModel
has a matching property.
In this particular case, I do have the ability to change my base model to inherit TableEntity
but I have future cases where that will not be possible, as my application will not be defining those models.
Any idea when this will be resolved ?
Triaged and accepted for the v1.0.9 release
This had been addressed in v1.0.7. That said, TableEntityAdapter is not the usage pattern we want to support going forward. We'll mark it as obsolete in v.1.0.9 and remove in v2.0.0+.
** SDK version
Confirmed in Nuget Package
** Issue reproduce steps
TableQuery<ModelAdapter>
query and note the null reference** Whether the issue is consistent or sporadic
Consistent.
** Environment Summary
ASP.NET Core, Azure App Service
** Any other context, such as stack trace or log.
Unsure if related, but seems very similar to this issue: https://github.com/Azure/azure-storage-net/issues/659