From: <jul...@us...> - 2011-01-17 15:39:35
|
Revision: 5362 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5362&view=rev Author: julian-maughan Date: 2011-01-17 15:39:29 +0000 (Mon, 17 Jan 2011) Log Message: ----------- Deprecated ISession.SaveOrUpdateCopy methods - they are replaced by Merge methods which are functionally identical [ref. NH-2508] Modified Paths: -------------- trunk/nhibernate/doc/reference/modules/manipulating_data.xml trunk/nhibernate/doc/reference/modules/performance.xml trunk/nhibernate/releasenotes.txt trunk/nhibernate/src/NHibernate/Engine/CascadeStyle.cs trunk/nhibernate/src/NHibernate/Engine/CascadingAction.cs trunk/nhibernate/src/NHibernate/Event/IEventSource.cs trunk/nhibernate/src/NHibernate/ISession.cs trunk/nhibernate/src/NHibernate/Impl/SessionImpl.cs Modified: trunk/nhibernate/doc/reference/modules/manipulating_data.xml =================================================================== --- trunk/nhibernate/doc/reference/modules/manipulating_data.xml 2011-01-17 15:04:02 UTC (rev 5361) +++ trunk/nhibernate/doc/reference/modules/manipulating_data.xml 2011-01-17 15:39:29 UTC (rev 5362) @@ -633,14 +633,14 @@ </itemizedlist> <para> - The last case can be avoided by using <literal>SaveOrUpdateCopy(Object o)</literal>. This method + The last case can be avoided by using <literal>Merge(Object o)</literal>. This method copies 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. The method returns the persistent instance. If the given instance is unsaved or does not exist in the database, NHibernate will save it and return it as a newly persistent instance. Otherwise, the given instance does not become associated with the session. In most applications with detached objects, you need both methods, <literal>SaveOrUpdate()</literal> - and <literal>SaveOrUpdateCopy()</literal>. + and <literal>Merge()</literal>. </para> </sect2> Modified: trunk/nhibernate/doc/reference/modules/performance.xml =================================================================== --- trunk/nhibernate/doc/reference/modules/performance.xml 2011-01-17 15:04:02 UTC (rev 5361) +++ trunk/nhibernate/doc/reference/modules/performance.xml 2011-01-17 15:39:29 UTC (rev 5362) @@ -481,7 +481,7 @@ <listitem> <para> You may also attach a previously loaded object to a new <literal>ISession</literal> - with <literal>SaveOrUpdateCopy()</literal> or <literal>Lock()</literal> before + with <literal>Merge()</literal> or <literal>Lock()</literal> before accessing uninitialized collections (or other proxies). No, NHibernate does not, and certainly <emphasis>should</emphasis> not do this automatically, since it would introduce ad hoc transaction semantics! Modified: trunk/nhibernate/releasenotes.txt =================================================================== --- trunk/nhibernate/releasenotes.txt 2011-01-17 15:04:02 UTC (rev 5361) +++ trunk/nhibernate/releasenotes.txt 2011-01-17 15:39:29 UTC (rev 5362) @@ -1,5 +1,8 @@ ** Known BREAKING CHANGES from NH3.0.0.GA to NH3.0.1.GA + ##### Design time ##### + * [NH-2481] - Deprecated: ISession.SaveOrUpdateCopy methods - use ISession.Merge methods instead + ##### Run time ##### * [NH-2481] - An exception will now be thrown when an entity references a transient entity and cascade="merge|all" is not configured on the association Modified: trunk/nhibernate/src/NHibernate/Engine/CascadeStyle.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Engine/CascadeStyle.cs 2011-01-17 15:04:02 UTC (rev 5361) +++ trunk/nhibernate/src/NHibernate/Engine/CascadeStyle.cs 2011-01-17 15:39:29 UTC (rev 5362) @@ -153,7 +153,7 @@ { public override bool DoCascade(CascadingAction action) { - return action == CascadingAction.Merge; + return action == CascadingAction.Merge || action == CascadingAction.SaveUpdateCopy; } } Modified: trunk/nhibernate/src/NHibernate/Engine/CascadingAction.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Engine/CascadingAction.cs 2011-01-17 15:04:02 UTC (rev 5361) +++ trunk/nhibernate/src/NHibernate/Engine/CascadingAction.cs 2011-01-17 15:39:29 UTC (rev 5362) @@ -1,3 +1,4 @@ +using System; using System.Collections; using Iesi.Collections; @@ -286,6 +287,7 @@ } } + [Obsolete("Replaced by MergeCascadingAction")] private class SaveUpdateCopyCascadingAction : CascadingAction { // for deprecated saveOrUpdateCopy() Modified: trunk/nhibernate/src/NHibernate/Event/IEventSource.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Event/IEventSource.cs 2011-01-17 15:04:02 UTC (rev 5361) +++ trunk/nhibernate/src/NHibernate/Event/IEventSource.cs 2011-01-17 15:39:29 UTC (rev 5362) @@ -1,3 +1,4 @@ +using System; using System.Collections; using Iesi.Collections; using NHibernate.Engine; @@ -32,10 +33,10 @@ void Refresh(object obj, IDictionary refreshedAlready); /// <summary> Cascade copy an entity instance</summary> + [Obsolete("Use Merge(string, object, IDictionary) instead")] void SaveOrUpdateCopy(string entityName, object obj, IDictionary copiedAlready); /// <summary> Cascade delete an entity instance</summary> void Delete(string entityName, object child, bool isCascadeDeleteEnabled, ISet transientEntities); } - } Modified: trunk/nhibernate/src/NHibernate/ISession.cs =================================================================== --- trunk/nhibernate/src/NHibernate/ISession.cs 2011-01-17 15:04:02 UTC (rev 5361) +++ trunk/nhibernate/src/NHibernate/ISession.cs 2011-01-17 15:39:29 UTC (rev 5362) @@ -420,7 +420,7 @@ /// The semantics of this method are defined by JSR-220. /// <param name="entityName">Name of the entity.</param> /// <param name="obj">a detached instance with state to be copied </param> - /// <returns> an updated persistent instance </returns> + /// <returns> an updated persistent instance </returns> /// </summary> /// <returns></returns> object Merge(string entityName, object obj); @@ -452,6 +452,7 @@ /// </summary> /// <param name="obj">a transient instance with state to be copied</param> /// <returns>an updated persistent instance</returns> + [Obsolete("Use Merge(object) instead")] object SaveOrUpdateCopy(object obj); /// <summary> @@ -465,6 +466,7 @@ /// <param name="obj">a persistent or transient instance with state to be copied</param> /// <param name="id">the identifier of the instance to copy to</param> /// <returns>an updated persistent instance</returns> + [Obsolete("No direct replacement. Use Merge instead.")] object SaveOrUpdateCopy(object obj, object id); /// <summary> Modified: trunk/nhibernate/src/NHibernate/Impl/SessionImpl.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Impl/SessionImpl.cs 2011-01-17 15:04:02 UTC (rev 5361) +++ trunk/nhibernate/src/NHibernate/Impl/SessionImpl.cs 2011-01-17 15:39:29 UTC (rev 5362) @@ -956,6 +956,7 @@ } /// <summary> Cascade copy an entity instance</summary> + [Obsolete("Use Merge(string, object, IDictionary) instead")] public void SaveOrUpdateCopy(string entityName, object obj, IDictionary copiedAlready) { using (new SessionIdLoggingContext(SessionId)) @@ -2103,11 +2104,7 @@ } } - /// <summary> - /// - /// </summary> - /// <param name="obj"></param> - /// <returns></returns> + [Obsolete("Use Merge(object) instead")] public object SaveOrUpdateCopy(object obj) { using (new SessionIdLoggingContext(SessionId)) @@ -2116,6 +2113,7 @@ } } + [Obsolete("No direct replacement. Use Merge instead.")] public object SaveOrUpdateCopy(object obj, object id) { using (new SessionIdLoggingContext(SessionId)) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |