简体   繁体   中英

.Net AWS DynamoDB Updating items

I am using dynamodb object persistence model with .net core c#.

I am using the following to save my data:

public Task SaveAsync(T item)
{
   return base.SaveAsync(item, _config);
}

While this works fine. I wanted to know how can I update items instead of saving. What I have is that I need to delete the item, and then call save again. Is it possible to overwrite the item instead of deleting and resaving.

For ex I have an item with key as my guid , when I call save I have to first delete this item and then insert another entry with a different guid.

Any update which is available with dynamo db?

Anyone?

How are you retrieving the item? are you getting it via the dbcontext? or dbClient?

When using the Object Persistance model , you should just save the item. the framework will take care of the update in the background. My assumption/guess is that you are loading the data outside of the dbcontext. So when you go to save it, it assumes you want to create a new item.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM