I'm trying to update a database using the Session lybrary and transactions. I have a function that does some work on objects and then updates the DB. Here is my code:
using (_session.BeginTransaction())
{
_session.SaveOrUpdate(foo);
_session.Transaction.CommitAsync();
}
foo
is the object i'm trying to update. Now the thing is I call this function more than once using a for loop and the database gets updated only the first time.
I solved it. I'm not really sure what was the problem the only thing i did differently was retriving all objects first before start saving them back.
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.