2

In the new SDK package - Azure.Data.Tables, how can you intercept the calls done to table storage / cosmos. In the previous package (Microsoft.WindowsAzure.Storage) it could be done through the method IDictionary<string, EntityProperty> WriteEntity(OperationContext operationContext) or ReadEntity. But now it seems that no interceptor is available. Those were handy when we saved nullable types to Storage - for example int? or Guid?.

David Makogon
  • 69,407
  • 21
  • 141
  • 189
Corovei Andrei
  • 1,646
  • 6
  • 28
  • 42

1 Answers1

1

Azure.Data.Tables has no interceptor concept, however it also allows you to define entities with properties of type int? or Guid?. When adding an entity to the table, any null properties are omitted from the entity.

Christopher Scott
  • 2,676
  • 2
  • 26
  • 26
  • I noticed that, thank you Christopher for the answer. However, using the previous Package we defined an interceptor that will write Int.Null in a string column to allow null for that record. In order to migrate, we have to support fetching those rows as well. The best I could think of is to override TablesTypeBinder, but that would mean working with local versions of nuget packages.. – Corovei Andrei Feb 18 '22 at 15:29
  • Just curious, why do you write string values to indicate null when the model will deserialize the absent column value as null naturally? – Christopher Scott Feb 19 '22 at 19:18
  • In the new package, yes. But we used the old package - WindowsAzure.Storage where it was not the case. – Corovei Andrei Feb 21 '22 at 13:03
  • OK, makes sense. I thought you meant that you'd still need to do that with the new package. – Christopher Scott Feb 24 '22 at 19:30