Hey guys,
I have a scenario where we are running a code that consume some processing
time. This progress of this process need to be updated on the database. Let
me show some code to make a better explanation. Our method that update the
progress on the database look like this:
void UpdateProgress()
{
routine.Progress = GetCurrentProgress();
// other stats of the processing properties
using (var session = factory.OpenSession())
{
session.Merge(routine);
session.Flush();
}
}
And we call it from another scope:
var routine = GetRoutine(); // get it using session.Linq<> ...
foreach (var item in collection)
{
// some code
UpdateProgress();
}
The code works fine on the first, second and maybe third times when it
calls UpdateProgress method, but after that, I got an error where the
object is already on the session with the same identifier (on the
UpdateProgress). My question is, why I got this error if I open a new
session to persist the state?
Thank you.
--
______________________________________
Felipe B Oriani
[email protected]
--
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/d/optout.