/// <summary> /// Is this instance persistent or detached? /// </summary> /// <remarks> /// If <paramref name="assumed"/> is non-null, don't hit the database to make the /// determination, instead assume that value; the client code must be /// prepared to "recover" in the case that this assumed result is incorrect. /// </remarks> public static bool IsNotTransient(string entityName, System.Object entity, bool?assumed, ISessionImplementor session) { if (entity.IsProxy()) { return(true); } if (session.PersistenceContext.IsEntryFor(entity)) { return(true); } return(!IsTransient(entityName, entity, assumed, session)); }