From: Peter S. <sz...@us...> - 2004-04-29 14:01:32
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32453/NHibernate Modified Files: FlushMode.cs HibernateException.cs NHibernate.cs Log Message: Some small H2.0.3 compatibility fix Index: FlushMode.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/FlushMode.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** FlushMode.cs 17 Feb 2003 18:16:13 -0000 1.1 --- FlushMode.cs 29 Apr 2004 14:00:51 -0000 1.2 *************** *** 16,29 **** /// transactions /// </summary> ! Never, /// <summary> /// The <c>ISession</c> is flushed when <c>Transaction.Commit()</c> is called /// </summary> ! Commit, /// <summary> /// The <c>ISession</c> is sometimes flushed before query execution in order to /// ensure that queries never return stale state. This is the default flush mode. /// </summary> ! Auto } } --- 16,29 ---- /// transactions /// </summary> ! Never = 0, /// <summary> /// The <c>ISession</c> is flushed when <c>Transaction.Commit()</c> is called /// </summary> ! Commit = 5, /// <summary> /// The <c>ISession</c> is sometimes flushed before query execution in order to /// ensure that queries never return stale state. This is the default flush mode. /// </summary> ! Auto = 10 } } Index: NHibernate.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/NHibernate.cs,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** NHibernate.cs 21 Apr 2004 14:31:09 -0000 1.16 --- NHibernate.cs 29 Apr 2004 14:00:51 -0000 1.17 *************** *** 1,3 **** --- 1,4 ---- using System; + using System.IO; using NHibernate.SqlTypes; *************** *** 170,174 **** /// A NHibernate serializable type /// </summary> ! /// <param name="serializableClass"></param> /// <returns></returns> public static IType Any(IType metaType, IType identifierType) { --- 171,176 ---- /// A NHibernate serializable type /// </summary> ! /// <param name="metaType">a type mapping <see cref="NHibernate.Type.IType"/> to a single column</param> ! /// <param name="identifierType">the entity identifier type</param> /// <returns></returns> public static IType Any(IType metaType, IType identifierType) { *************** *** 181,184 **** --- 183,187 ---- /// <param name="persistentClass">a mapped entity class</param> /// <returns></returns> + [Obsolete("use NHibernate.Entity instead")] public static IType Association(System.Type persistentClass) { // not really a many-to-one association *necessarily* *************** *** 187,190 **** --- 190,204 ---- /// <summary> + /// A NHibernate persistent object (entity) type + /// </summary> + /// <param name="persistentClass">a mapped entity class</param> + /// <returns></returns> + public static IType Entity(System.Type persistentClass) + { + // not really a many-to-one association *necessarily* + return new ManyToOneType(persistentClass); + } + + /// <summary> /// A NHibernate custom type /// </summary> *************** *** 192,199 **** /// <returns></returns> public static IType Custom(System.Type userTypeClass) { ! if( typeof(ICompositeUserType).IsAssignableFrom( userTypeClass )) { return new CompositeCustomType( userTypeClass ); } ! else { return new CustomType(userTypeClass); } --- 206,215 ---- /// <returns></returns> public static IType Custom(System.Type userTypeClass) { ! if( typeof(ICompositeUserType).IsAssignableFrom( userTypeClass )) ! { return new CompositeCustomType( userTypeClass ); } ! else ! { return new CustomType(userTypeClass); } *************** *** 207,217 **** /// <exception cref="HibernateException">if we can't initialize the proxy at this time, eg. the Session was closed</exception> public static void Initialize(object proxy) { ! if (proxy==null) { return; } ! else if ( proxy is HibernateProxy ) { ! ((HibernateProxy) proxy).Initialize(); } ! else if ( proxy is PersistentCollection ) { ( (PersistentCollection) proxy ).ForceLoad(); } --- 223,236 ---- /// <exception cref="HibernateException">if we can't initialize the proxy at this time, eg. the Session was closed</exception> public static void Initialize(object proxy) { ! if (proxy==null) ! { return; } ! else if ( proxy is HibernateProxy ) ! { ! HibernateProxyHelper.GetLazyInitializer( (HibernateProxy) proxy ).Initialize(); } ! else if ( proxy is PersistentCollection ) ! { ( (PersistentCollection) proxy ).ForceLoad(); } *************** *** 223,241 **** /// <param name="proxy">a persistable object, proxy, persistent collection or null</param> /// <returns>true if the argument is already initialized, or is not a proxy or collection</returns> ! public static bool IsInitialized(object proxy) { ! if ( proxy is HibernateProxy ) { return !HibernateProxyHelper.GetLazyInitializer( (HibernateProxy) proxy ).IsUninitialized; ! } else if ( proxy is PersistentCollection ) { return ( (PersistentCollection) proxy).WasInitialized; ! } else { return true; } } ! public System.Type GetClass(object proxy) { ! if(proxy is HibernateProxy) { return HibernateProxyHelper.GetLazyInitializer( (HibernateProxy) proxy ).GetImplementation().GetType(); } ! else { return proxy.GetType(); } --- 242,275 ---- /// <param name="proxy">a persistable object, proxy, persistent collection or null</param> /// <returns>true if the argument is already initialized, or is not a proxy or collection</returns> ! public static bool IsInitialized(object proxy) ! { ! if ( proxy is HibernateProxy ) ! { return !HibernateProxyHelper.GetLazyInitializer( (HibernateProxy) proxy ).IsUninitialized; ! } ! else if ( proxy is PersistentCollection ) ! { return ( (PersistentCollection) proxy).WasInitialized; ! } ! else ! { return true; } } ! /// <summary> ! /// Get the true, underlying class of a proxied persistent class. This operation ! /// will initialize a proxy by side-effect. ! /// </summary> ! /// <param name="proxy">a persistable object or proxy</param> ! /// <returns>the true class of the instance</returns> ! public System.Type GetClass(object proxy) ! { ! if(proxy is HibernateProxy) ! { return HibernateProxyHelper.GetLazyInitializer( (HibernateProxy) proxy ).GetImplementation().GetType(); } ! else ! { return proxy.GetType(); } *************** *** 258,262 **** /// <param name="length">the number of bytes in the stream</param> /// <returns></returns> ! public static Blob CreateBlob(StreamReader stream, int length) { return new BlobImpl(stream, length); } --- 292,296 ---- /// <param name="length">the number of bytes in the stream</param> /// <returns></returns> ! public static Blob CreateBlob(TextReader stream, int length) { return new BlobImpl(stream, length); } *************** *** 266,275 **** /// </summary> /// <param name="stream">a binary stream</param> /// <returns></returns> ! public static Blob CreateBlob(StreamReader stream) { return new BlobImpl( stream, stream.available() ); } /// <summary> /// Create a new Clob. The returned object will be /// initially immutable. --- 300,331 ---- /// </summary> /// <param name="stream">a binary stream</param> + /// <param name="length">the number of bytes in the stream</param> /// <returns></returns> ! public static Blob CreateBlob(BinaryReader stream, int length) ! { ! return new BlobImpl(stream, length); ! } ! ! /// <summary> ! /// Create a new Blob. The returned object will be initially immutable. ! /// </summary> ! /// <param name="stream">a binary stream</param> ! /// <returns></returns> ! public static Blob CreateBlob(StreamReader stream) ! { return new BlobImpl( stream, stream.available() ); } /// <summary> + /// Create a new Blob. The returned object will be initially immutable. + /// </summary> + /// <param name="stream">a binary stream</param> + /// <returns></returns> + public static Blob CreateBlob(BinaryReader stream) + { + return new BlobImpl( stream, stream.available() ); + } + + /// <summary> /// Create a new Clob. The returned object will be /// initially immutable. *************** *** 277,281 **** /// <param name="str">a String</param> /// <returns></returns> ! public static Clob CreateClob(String str) { return new ClobImpl(str); } --- 333,338 ---- /// <param name="str">a String</param> /// <returns></returns> ! public static Clob CreateClob(string str) ! { return new ClobImpl(str); } *************** *** 287,291 **** /// <param name="length">the number of characters in the stream</param> /// <returns></returns> ! public static Clob CreateClob(StreamReader reader, int length) { return new ClobImpl(reader, length); } --- 344,348 ---- /// <param name="length">the number of characters in the stream</param> /// <returns></returns> ! public static Clob CreateClob(TextReader reader, int length) { return new ClobImpl(reader, length); } Index: HibernateException.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/HibernateException.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** HibernateException.cs 17 Feb 2003 18:16:13 -0000 1.1 --- HibernateException.cs 29 Apr 2004 14:00:51 -0000 1.2 *************** *** 9,13 **** public class HibernateException : ApplicationException { ! public HibernateException(Exception e) : base("", e) { } public HibernateException(string str, Exception e) : base(str, e) { } --- 9,13 ---- public class HibernateException : ApplicationException { ! public HibernateException(Exception e) : base(string.Empty, e) { } public HibernateException(string str, Exception e) : base(str, e) { } |