I'm not sure what relevance the multi-threaded aspect of the application
is - from the reference to locking, I'm wondering if you've got a
problem with session handling which is complicating the real logic?
>From what I understand, I think the following would probably do what you
want using the QueryOver API:
var entity = NhSession.QueryOver<Foo>()
.Where(x => x. Name == "Foo")
.Lock().Upgrade
.SingleOrDefault();
if(entity == null) ...
From: [email protected] [mailto:[email protected]] On
Behalf Of Jason Clark
Sent: 20 April 2013 16:44
To: [email protected]
Subject: [nhusers] If entity exists that is safe across different
processes.
I've been banging my head off what should be a simple issue. I'm trying
to do the following basic operation
1) Check if entity exists by a field other than ID
2) If not, create entity
Problem is this is in a console app that is multi-threaded, so I need to
somehow get an entity by a field other than the ID and set the LockMode
to Upgrade (or at least I think thats what needs to be done). From what
I see there is no way to do that with ISession.
Any ideas?
--
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 http://groups.google.com/group/nhusers?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.
--
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 http://groups.google.com/group/nhusers?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.