Async table storage Insertion issue

Nishanth Sekar 1 Reputation point
2021-04-29T06:35:37.57+00:00

While inserting in azure table storage using Async method some records are getting failed to insert in table storage?

Azure Table Storage
Azure Table Storage
An Azure service that stores structured NoSQL data in the cloud.
171 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. KalyanChanumolu-MSFT 8,336 Reputation points
    2021-04-29T09:14:27.927+00:00

    anonymous user Welcome to Microsoft Q&A forums.

    Here is a function I wrote using the Azure.Data.Tables (beta) SDK

    public async Task InsertOrMergeEntityAsync<T>(string tableName, T tableEntity) where T : class, ITableEntity, new()  
            {  
                try  
                {  
                    if (tableEntity == null)  
                    {  
                        throw new ArgumentNullException("InsertOrMergeEntityAsync");  
                    }  
      
                    // Create a table client for interacting with the table service  
                    var tableClient = GetAuthenticatedTableClient(tableName);  
      
                    var result = await tableClient.UpsertEntityAsync(tableEntity, TableUpdateMode.Merge);  
      
                    //if (result.RequestCharge.HasValue)  
                    //{  
                    //    Console.WriteLine("Request Charge of Delete Operation: " + result.RequestCharge);  
                    //}  
                }  
                catch (Exception ex)  
                {  
                    Console.WriteLine(ex.Message);  
                }  
            }  
    

    Do let us know if you have any questions

    ----------

    If an answer is helpful, please "Accept answer" or "Up-Vote" which might help other community members reading this thread.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.