nhibernate - Session evict and merge for entity update -


i found piece of code:

    public virtual void update(t entity) {         logger.debug("update {0}", entity);         session.evict(entity);         session.merge(entity);     } 

can explain pros , cons of calling on calling update on session? why working, mechanics behind code? not hacky?

session.evict evicts single object session, sample, if have obj on session , try call session.update(entity) exception saying obj on session , cannot update.

session.merge merge single object existent object on session (cache) , update.

take look: https://stackoverflow.com/a/9161057/316799


Comments

Popular posts from this blog

Change php variable from jquery value using ajax (same page) -

Pull out data related to my apps from Android Play Store and iOS App Store -

How can I fetch data from a web server in an android application? -