Thanks for your response! I am not yet comfortable with the optimistic
concurrency with dynamic update option. I will have to think more
about that.

In the mean time, I found a dirty way to get my issue to work using
the Interceptor. I looked through the NHib code and found that it
stores the version in Entityentry.Version when the entity is loaded.
After that, this is the value used for generating the where clause in
the update statement. I can use the PreFlush method to set the version
to what I need. I need to add more validations and see if it works in
all scenarios. Hopefully it will not trash the application in
unexpected ways.

        public override void PreFlush(System.Collections.ICollection
entitites)
        {
            ISessionImplementor session =
(ISessionImplementor)SessionManagerFactory.SessionManager.Session;

            foreach (object entity in entitites)
            {
                if (entity is IVersionedEntity)
                {

                    session.GetEntry(entity).Version =
((IVersionedEntity)entity).RowVersion;
                }
            }
        }

On Apr 16, 3:30 pm, "[email protected]"
<[email protected]> wrote:
> Why not use optimistic concurrency and dynamic updates instead?

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to