From: Kevin W. <kev...@us...> - 2004-12-31 23:56:05
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Type In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24797 Modified Files: SortedSetType.cs StringClobType.cs StringType.cs TicksType.cs TimeSpanType.cs Log Message: fixing xml comments and letting ReSharper do reformatting Index: TimeSpanType.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Type/TimeSpanType.cs,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** TimeSpanType.cs 20 Dec 2004 04:49:03 -0000 1.8 --- TimeSpanType.cs 31 Dec 2004 23:55:53 -0000 1.9 *************** *** 1,10 **** using System; using System.Data; - using NHibernate.SqlTypes; ! namespace NHibernate.Type { - /// <summary> /// Maps a <see cref="System.TimeSpan" /> Property to an <see cref="DbType.Int64" /> column --- 1,8 ---- using System; using System.Data; using NHibernate.SqlTypes; ! namespace NHibernate.Type { /// <summary> /// Maps a <see cref="System.TimeSpan" /> Property to an <see cref="DbType.Int64" /> column *************** *** 12,61 **** public class TimeSpanType : ValueTypeType, IVersionType, ILiteralType { ! internal TimeSpanType() : base( new Int64SqlType() ) { } ! public override object Get(IDataReader rs, int index) { ! return new TimeSpan( Convert.ToInt64(rs[index]) ); } ! public override object Get(IDataReader rs, string name) { ! return Get(rs, rs.GetOrdinal(name)); } ! public override System.Type ReturnedClass { ! get { return typeof(TimeSpan); } } ! public override void Set(IDbCommand st, object value, int index) { ! IDataParameter parm = st.Parameters[index] as IDataParameter; ! parm.Value = ((TimeSpan)value).Ticks; } ! public override string Name { get { return "TimeSpan"; } } ! public override string ToXML(object val) { ! return ((TimeSpan)val).Ticks.ToString(); } ! public override bool Equals(object x, object y) { ! if (x==y) return true; ! if (x==null || y==null) return false; ! long xTime = ((TimeSpan)x).Ticks; ! long yTime = ((TimeSpan)y).Ticks; ! return xTime == yTime; } ! public override bool HasNiceEquals { get { return true; } --- 10,98 ---- public class TimeSpanType : ValueTypeType, IVersionType, ILiteralType { ! /// <summary></summary> ! internal TimeSpanType() : base( new Int64SqlType() ) { } ! /// <summary> ! /// ! /// </summary> ! /// <param name="rs"></param> ! /// <param name="index"></param> ! /// <returns></returns> ! public override object Get( IDataReader rs, int index ) { ! return new TimeSpan( Convert.ToInt64( rs[ index ] ) ); } ! /// <summary> ! /// ! /// </summary> ! /// <param name="rs"></param> ! /// <param name="name"></param> ! /// <returns></returns> ! public override object Get( IDataReader rs, string name ) { ! return Get( rs, rs.GetOrdinal( name ) ); } ! /// <summary></summary> ! public override System.Type ReturnedClass { ! get { return typeof( TimeSpan ); } } ! /// <summary> ! /// ! /// </summary> ! /// <param name="st"></param> ! /// <param name="value"></param> ! /// <param name="index"></param> ! public override void Set( IDbCommand st, object value, int index ) { ! IDataParameter parm = st.Parameters[ index ] as IDataParameter; ! parm.Value = ( ( TimeSpan ) value ).Ticks; } ! /// <summary></summary> ! public override string Name { get { return "TimeSpan"; } } ! /// <summary> ! /// ! /// </summary> ! /// <param name="val"></param> ! /// <returns></returns> ! public override string ToXML( object val ) { ! return ( ( TimeSpan ) val ).Ticks.ToString(); } ! /// <summary> ! /// ! /// </summary> ! /// <param name="x"></param> ! /// <param name="y"></param> ! /// <returns></returns> ! public override bool Equals( object x, object y ) { ! if( x == y ) ! { ! return true; ! } ! if( x == null || y == null ) ! { ! return false; ! } ! long xTime = ( ( TimeSpan ) x ).Ticks; ! long yTime = ( ( TimeSpan ) y ).Ticks; ! return xTime == yTime; } ! /// <summary></summary> ! public override bool HasNiceEquals { get { return true; } *************** *** 64,73 **** #region IVersionType Members ! public object Next(object current) { return Seed; } ! ! public object Seed { get { return new TimeSpan( DateTime.Now.Ticks ); } --- 101,116 ---- #region IVersionType Members ! /// <summary> ! /// ! /// </summary> ! /// <param name="current"></param> ! /// <returns></returns> ! public object Next( object current ) { return Seed; } ! ! /// <summary></summary> ! public object Seed { get { return new TimeSpan( DateTime.Now.Ticks ); } *************** *** 76,84 **** #endregion ! public override string ObjectToSQLString(object value) { ! return "'" + ((TimeSpan)value).Ticks.ToString() + "'"; } } ! } ! --- 119,131 ---- #endregion ! /// <summary> ! /// ! /// </summary> ! /// <param name="value"></param> ! /// <returns></returns> ! public override string ObjectToSQLString( object value ) { ! return "'" + ( ( TimeSpan ) value ).Ticks.ToString() + "'"; } } ! } \ No newline at end of file Index: StringType.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Type/StringType.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** StringType.cs 25 Oct 2004 05:37:56 -0000 1.6 --- StringType.cs 31 Dec 2004 23:55:53 -0000 1.7 *************** *** 1,55 **** using System; using System.Data; - using NHibernate.SqlTypes; using NHibernate.Util; ! ! namespace NHibernate.Type { ! /// <summary> /// Maps a <see cref="System.String" /> to a <see cref="DbType.String" /> column. /// </summary> ! public class StringType : ImmutableType, IDiscriminatorType { ! ! internal StringType() : base( new StringSqlType() ) { } ! internal StringType(StringSqlType sqlType) : base(sqlType) { } ! public override object Get(IDataReader rs, int index) { ! return Convert.ToString(rs[index]); } ! public override object Get(IDataReader rs, string name) { ! return Convert.ToString(rs[name]); } ! public override System.Type ReturnedClass { ! get { return typeof(string); } } ! public override void Set(IDbCommand st, object value, int index) { ! IDataParameter parm = st.Parameters[index] as IDataParameter; parm.Value = value; } ! public override string Name { get { return "String"; } } ! public string ObjectToSQLString(object value) { ! return "'" + (string) value + "'"; } ! public object StringToObject(string xml) { return xml; } ! public override bool Equals(object x, object y) { ! return ObjectUtils.Equals(x, y); } ! public override string ToXML(object value) { ! return (string) value; } } ! } --- 1,113 ---- using System; using System.Data; using NHibernate.SqlTypes; using NHibernate.Util; ! namespace NHibernate.Type ! { /// <summary> /// Maps a <see cref="System.String" /> to a <see cref="DbType.String" /> column. /// </summary> ! public class StringType : ImmutableType, IDiscriminatorType ! { ! /// <summary></summary> ! internal StringType() : base( new StringSqlType() ) { } ! /// <summary> ! /// ! /// </summary> ! /// <param name="sqlType"></param> ! internal StringType( StringSqlType sqlType ) : base( sqlType ) ! { } ! /// <summary> ! /// ! /// </summary> ! /// <param name="rs"></param> ! /// <param name="index"></param> ! /// <returns></returns> ! public override object Get( IDataReader rs, int index ) ! { ! return Convert.ToString( rs[ index ] ); } ! /// <summary> ! /// ! /// </summary> ! /// <param name="rs"></param> ! /// <param name="name"></param> ! /// <returns></returns> ! public override object Get( IDataReader rs, string name ) ! { ! return Convert.ToString( rs[ name ] ); } ! ! /// <summary></summary> ! public override System.Type ReturnedClass ! { ! get { return typeof( string ); } } ! ! /// <summary> ! /// ! /// </summary> ! /// <param name="st"></param> ! /// <param name="value"></param> ! /// <param name="index"></param> ! public override void Set( IDbCommand st, object value, int index ) ! { ! IDataParameter parm = st.Parameters[ index ] as IDataParameter; parm.Value = value; } ! /// <summary></summary> ! public override string Name ! { get { return "String"; } } ! ! /// <summary> ! /// ! /// </summary> ! /// <param name="value"></param> ! /// <returns></returns> ! public string ObjectToSQLString( object value ) ! { ! return "'" + ( string ) value + "'"; } ! ! /// <summary> ! /// ! /// </summary> ! /// <param name="xml"></param> ! /// <returns></returns> ! public object StringToObject( string xml ) ! { return xml; } ! /// <summary> ! /// ! /// </summary> ! /// <param name="x"></param> ! /// <param name="y"></param> ! /// <returns></returns> ! public override bool Equals( object x, object y ) ! { ! return ObjectUtils.Equals( x, y ); } ! /// <summary> ! /// ! /// </summary> ! /// <param name="value"></param> ! /// <returns></returns> ! public override string ToXML( object value ) ! { ! return ( string ) value; } } ! } \ No newline at end of file Index: TicksType.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Type/TicksType.cs,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** TicksType.cs 25 Oct 2004 05:37:56 -0000 1.7 --- TicksType.cs 31 Dec 2004 23:55:53 -0000 1.8 *************** *** 1,10 **** using System; using System.Data; - using NHibernate.SqlTypes; ! namespace NHibernate.Type { - /// <summary> /// Maps a <see cref="System.DateTime" /> Property to an <see cref="DbType.Int64" /> column --- 1,8 ---- using System; using System.Data; using NHibernate.SqlTypes; ! namespace NHibernate.Type { /// <summary> /// Maps a <see cref="System.DateTime" /> Property to an <see cref="DbType.Int64" /> column *************** *** 17,66 **** public class TicksType : ValueTypeType, IVersionType, ILiteralType { ! internal TicksType() : base( new Int64SqlType() ) { } ! public override object Get(IDataReader rs, int index) { ! return new DateTime( Convert.ToInt64(rs[index]) ); } ! public override object Get(IDataReader rs, string name) { ! return Get(rs, rs.GetOrdinal(name)); } ! public override System.Type ReturnedClass { ! get { return typeof(DateTime); } } ! public override void Set(IDbCommand st, object value, int index) { ! IDataParameter parm = st.Parameters[index] as IDataParameter; ! parm.Value = ((DateTime)value).Ticks; } ! public override string Name { get { return "Ticks"; } } ! public override string ToXML(object val) { ! return ((DateTime)val).Ticks.ToString(); } ! public override bool Equals(object x, object y) { ! if (x==y) return true; ! if (x==null || y==null) return false; ! long xTime = ((DateTime)x).Ticks; ! long yTime = ((DateTime)y).Ticks; ! return xTime == yTime; } ! public override bool HasNiceEquals { get { return true; } --- 15,109 ---- public class TicksType : ValueTypeType, IVersionType, ILiteralType { ! /// <summary></summary> ! internal TicksType() : base( new Int64SqlType() ) { } ! /// <summary> ! /// ! /// </summary> ! /// <param name="rs"></param> ! /// <param name="index"></param> ! /// <returns></returns> ! public override object Get( IDataReader rs, int index ) { ! return new DateTime( Convert.ToInt64( rs[ index ] ) ); } ! /// <summary> ! /// ! /// </summary> ! /// <param name="rs"></param> ! /// <param name="name"></param> ! /// <returns></returns> ! public override object Get( IDataReader rs, string name ) { ! return Get( rs, rs.GetOrdinal( name ) ); } ! /// <summary></summary> ! public override System.Type ReturnedClass { ! get { return typeof( DateTime ); } } ! /// <summary> ! /// ! /// </summary> ! /// <param name="st"></param> ! /// <param name="value"></param> ! /// <param name="index"></param> ! public override void Set( IDbCommand st, object value, int index ) { ! IDataParameter parm = st.Parameters[ index ] as IDataParameter; ! parm.Value = ( ( DateTime ) value ).Ticks; } ! /// <summary></summary> ! public override string Name { get { return "Ticks"; } } ! /// <summary> ! /// ! /// </summary> ! /// <param name="val"></param> ! /// <returns></returns> ! public override string ToXML( object val ) { ! return ( ( DateTime ) val ).Ticks.ToString(); } ! /// <summary> ! /// ! /// </summary> ! /// <param name="x"></param> ! /// <param name="y"></param> ! /// <returns></returns> ! public override bool Equals( object x, object y ) { ! if( x == y ) ! { ! return true; ! } ! if( x == null || y == null ) ! { ! return false; ! } ! long xTime = ( ( DateTime ) x ).Ticks; ! long yTime = ( ( DateTime ) y ).Ticks; ! return xTime == yTime; } ! /// <summary></summary> ! public override int GetHashCode() ! { ! return base.GetHashCode(); ! } ! ! /// <summary></summary> ! public override bool HasNiceEquals { get { return true; } *************** *** 69,78 **** #region IVersionType Members ! public object Next(object current) { return Seed; } ! ! public object Seed { get { return DateTime.Now; } --- 112,127 ---- #region IVersionType Members ! /// <summary> ! /// ! /// </summary> ! /// <param name="current"></param> ! /// <returns></returns> ! public object Next( object current ) { return Seed; } ! ! /// <summary></summary> ! public object Seed { get { return DateTime.Now; } *************** *** 81,89 **** #endregion ! public override string ObjectToSQLString(object value) { ! return "'" + ((DateTime)value).Ticks.ToString() + "'"; } } ! } ! --- 130,142 ---- #endregion ! /// <summary> ! /// ! /// </summary> ! /// <param name="value"></param> ! /// <returns></returns> ! public override string ObjectToSQLString( object value ) { ! return "'" + ( ( DateTime ) value ).Ticks.ToString() + "'"; } } ! } \ No newline at end of file Index: StringClobType.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Type/StringClobType.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** StringClobType.cs 25 Oct 2004 05:37:56 -0000 1.2 --- StringClobType.cs 31 Dec 2004 23:55:53 -0000 1.3 *************** *** 1,4 **** - using System; - using NHibernate.SqlTypes; --- 1,2 ---- *************** *** 16,31 **** public class StringClobType : StringType { ! internal StringClobType() : base( new StringClobSqlType() ) { } ! internal StringClobType(StringSqlType sqlType) : base(sqlType) { } public override string Name { ! get {return "StringClob"; } } } ! } --- 14,35 ---- public class StringClobType : StringType { ! /// <summary></summary> ! internal StringClobType() : base( new StringClobSqlType() ) { } ! /// <summary> ! /// ! /// </summary> ! /// <param name="sqlType"></param> ! internal StringClobType( StringSqlType sqlType ) : base( sqlType ) { } + /// <summary></summary> public override string Name { ! get { return "StringClob"; } } } ! } \ No newline at end of file Index: SortedSetType.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Type/SortedSetType.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** SortedSetType.cs 18 Nov 2004 02:44:10 -0000 1.5 --- SortedSetType.cs 31 Dec 2004 23:55:53 -0000 1.6 *************** *** 1,7 **** - using System; using System.Collections; ! using NHibernate.Collection; using NHibernate.Engine; namespace NHibernate.Type --- 1,7 ---- using System.Collections; ! using Iesi.Collections; using NHibernate.Collection; using NHibernate.Engine; + using SortedSet = NHibernate.Collection.SortedSet; namespace NHibernate.Type *************** *** 10,25 **** /// Extends the SetType to provide Sorting. /// </summary> ! public class SortedSetType : SetType { private IComparer comparer; ! public SortedSetType(string role, IComparer comparer) : base(role) { this.comparer = comparer; } ! public override PersistentCollection Instantiate(ISessionImplementor session, CollectionPersister persister) { ! SortedSet sortedSet = new SortedSet(session, comparer); return sortedSet; } --- 10,36 ---- /// Extends the SetType to provide Sorting. /// </summary> ! public class SortedSetType : SetType { private IComparer comparer; ! /// <summary> ! /// ! /// </summary> ! /// <param name="role"></param> ! /// <param name="comparer"></param> ! public SortedSetType( string role, IComparer comparer ) : base( role ) { this.comparer = comparer; } ! /// <summary> ! /// ! /// </summary> ! /// <param name="session"></param> ! /// <param name="persister"></param> ! /// <returns></returns> ! public override PersistentCollection Instantiate( ISessionImplementor session, CollectionPersister persister ) { ! SortedSet sortedSet = new SortedSet( session, comparer ); return sortedSet; } *************** *** 29,43 **** // doesn't have that I don't need to override it. ! public override PersistentCollection Wrap(ISessionImplementor session, object collection) { ! return new SortedSet(session, (Iesi.Collections.ISet)collection, comparer); ! } ! public override PersistentCollection AssembleCachedCollection(ISessionImplementor session, CollectionPersister persister, object disassembled, object owner) { ! return new SortedSet(session, persister, comparer, disassembled, owner); } ! } ! } --- 40,68 ---- // doesn't have that I don't need to override it. ! /// <summary> ! /// ! /// </summary> ! /// <param name="session"></param> ! /// <param name="collection"></param> ! /// <returns></returns> ! public override PersistentCollection Wrap( ISessionImplementor session, object collection ) { ! return new SortedSet( session, ( ISet ) collection, comparer ); ! } ! /// <summary> ! /// ! /// </summary> ! /// <param name="session"></param> ! /// <param name="persister"></param> ! /// <param name="disassembled"></param> ! /// <param name="owner"></param> ! /// <returns></returns> ! public override PersistentCollection AssembleCachedCollection( ISessionImplementor session, CollectionPersister persister, object disassembled, object owner ) { ! return new SortedSet( session, persister, comparer, disassembled, owner ); } ! } ! } \ No newline at end of file |