From: <fab...@us...> - 2011-07-10 15:16:51
|
Revision: 5978 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5978&view=rev Author: fabiomaulo Date: 2011-07-10 15:16:45 +0000 (Sun, 10 Jul 2011) Log Message: ----------- Fix NH-2743 Modified Paths: -------------- trunk/nhibernate/src/NHibernate/ISession.cs trunk/nhibernate/src/NHibernate/Impl/SessionImpl.cs Modified: trunk/nhibernate/src/NHibernate/ISession.cs =================================================================== --- trunk/nhibernate/src/NHibernate/ISession.cs 2011-07-09 20:30:42 UTC (rev 5977) +++ trunk/nhibernate/src/NHibernate/ISession.cs 2011-07-10 15:16:45 UTC (rev 5978) @@ -491,6 +491,36 @@ object Merge(string entityName, object obj); /// <summary> + /// Copy the state of the given object onto the persistent object with the same + /// identifier. If there is no persistent instance currently associated with + /// the session, it will be loaded. Return the persistent instance. If the + /// given instance is unsaved, save a copy of and return it as a newly persistent + /// instance. The given instance does not become associated with the session. + /// This operation cascades to associated instances if the association is mapped + /// with <tt>cascade="merge"</tt>.<br/> + /// The semantics of this method are defined by JSR-220. + /// </summary> + /// <param name="entity">a detached instance with state to be copied </param> + /// <returns> an updated persistent instance </returns> + T Merge<T>(T entity) where T : class; + + /// <summary> + /// Copy the state of the given object onto the persistent object with the same + /// identifier. If there is no persistent instance currently associated with + /// the session, it will be loaded. Return the persistent instance. If the + /// given instance is unsaved, save a copy of and return it as a newly persistent + /// instance. The given instance does not become associated with the session. + /// This operation cascades to associated instances if the association is mapped + /// with <tt>cascade="merge"</tt>.<br/> + /// The semantics of this method are defined by JSR-220. + /// <param name="entityName">Name of the entity.</param> + /// <param name="entity">a detached instance with state to be copied </param> + /// <returns> an updated persistent instance </returns> + /// </summary> + /// <returns></returns> + T Merge<T>(string entityName, T entity) where T : class; + + /// <summary> /// Make a transient instance persistent. This operation cascades to associated /// instances if the association is mapped with <tt>cascade="persist"</tt>.<br/> /// The semantics of this method are defined by JSR-220. Modified: trunk/nhibernate/src/NHibernate/Impl/SessionImpl.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Impl/SessionImpl.cs 2011-07-09 20:30:42 UTC (rev 5977) +++ trunk/nhibernate/src/NHibernate/Impl/SessionImpl.cs 2011-07-10 15:16:45 UTC (rev 5978) @@ -986,6 +986,16 @@ } } + public T Merge<T>(T entity) where T : class + { + return (T) Merge((object) entity); + } + + public T Merge<T>(string entityName, T entity) where T : class + { + return (T) Merge(entityName, (object) entity); + } + public object Merge(object obj) { using (new SessionIdLoggingContext(SessionId)) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |