I'm using Azure.Data.Tables.TableClient
(also looked at Azure.Data.Tables.TableServiceClient
).
I want to check if a record exists in the Azure Table given a specific Partition Key and Row Key. Calling the TableClient.GetEntity<T>
throws an exception if it gets 404 from the server rather than returning null.
I've searched on SO and there is one solution available but it uses the older CloudTable
.
I've tried looking at the TableServiceClient
options but so far haven't had any success finding a good solution that doesnt require catching the exception.
You can probably use Query
and specify your query as PartitionKey eq 'partition-key-value' and RowKey eq 'row-key-value'
.
If the entity does not exist, you will receive an empty array back instead of error. If the entity exists, you will receive an array with just 1 entity.