0

I am trying to get the stored data from the Azure table. However, when I am trying to parse the stored id from type Guid, I will get an empty Guid 00000000-0000-0000-0000-000000000000.

public async Task<List<T>> GetItemsAsync<T>() where T : class, ITableEntity
{        
    return await _skuTableClient.QueryAsync<T>().ToListAsync().ConfigureAwait(false);
}

This is my function to retrieve the data. T is in my case SkuInfoDto:

public class SkuInfoDto : ISkuInfo, ITableEntity
{
    public Guid Id { get; set; }
    public string Name { get; set; }
  
    public string Supplier { get; set; }

    public LicenseType Type { get; set; }

    public Guid EntraIdGroupId { get; set; }

    public string PartitionKey { get; set; }
    public string RowKey { get; set; }

    public DateTimeOffset? Timestamp { get; set; } = DateTimeOffset.UtcNow;
    public ETag ETag { get; set; } = ETag.All;
}

EDIT: Some comments said it already correct to change the type of the Id from Guid to string and parse it in the Code. The problem is that the Id is saved as a Guid in the Azure table and I can't change that, because the Azure table has a different owner. Data in the Azure table

4
  • Please provide more information about your schema. Or produce a minimal reproducable example. How is the Id configured? Do you set an Id while inserting? Commented Apr 25 at 9:23
  • 3
    @Lukas, Change the Guid properties in your class to string and manually convert them to/from Guid to avoid deserialization issues with Azure Table SDK. Commented Apr 25 at 9:39
  • 2
    Can you give us an example of the Id value that you expect converts to a Guid? Commented Apr 25 at 9:45
  • 2
    Store something like "3fa85f64-5717-4562-b3fc-2c963f66afa6" as a string in your class and later convert it back to a Guid in code using Guid.Parse(stringValue) Commented Apr 25 at 10:05

1 Answer 1

1

I found the error when a comment pointed out to share the data model. The model had the Id property in lower case and because of the case sensitivity of the properties I was unable to get the Id of the data.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.