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
Post a Comment