From: Kevin W. <kev...@us...> - 2004-12-31 23:52:31
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Type In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24224 Modified Files: CustomType.cs DateTimeType.cs DateType.cs DecimalType.cs DoubleType.cs Log Message: fixing xml comments and letting ReSharper do reformatting Index: DoubleType.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Type/DoubleType.cs,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** DoubleType.cs 25 Oct 2004 05:37:56 -0000 1.7 --- DoubleType.cs 31 Dec 2004 23:52:20 -0000 1.8 *************** *** 1,44 **** using System; using System.Data; - using NHibernate.SqlTypes; ! namespace NHibernate.Type { ! /// <summary> /// Maps a <see cref="System.Double"/> Property /// to a <see cref="DbType.Double"/> column. /// </summary> ! public class DoubleType : ValueTypeType { ! ! internal DoubleType() : base( new DoubleSqlType() ) { } ! public override object Get(IDataReader rs, int index) { ! return Convert.ToDouble(rs[index]); } ! public override object Get(IDataReader rs, string name) { ! return Convert.ToDouble(rs[name]); } ! public override System.Type ReturnedClass { ! get { return typeof(double); } } ! 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 "Double"; } } ! public override string ObjectToSQLString(object value) { return value.ToString(); } } ! } --- 1,74 ---- using System; using System.Data; using NHibernate.SqlTypes; ! namespace NHibernate.Type ! { /// <summary> /// Maps a <see cref="System.Double"/> Property /// to a <see cref="DbType.Double"/> column. /// </summary> ! public class DoubleType : ValueTypeType { ! /// <summary></summary> ! internal DoubleType() : base( new DoubleSqlType() ) { } ! /// <summary> ! /// ! /// </summary> ! /// <param name="rs"></param> ! /// <param name="index"></param> ! /// <returns></returns> ! public override object Get( IDataReader rs, int index ) ! { ! return Convert.ToDouble( rs[ index ] ); } ! /// <summary> ! /// ! /// </summary> ! /// <param name="rs"></param> ! /// <param name="name"></param> ! /// <returns></returns> ! public override object Get( IDataReader rs, string name ) ! { ! return Convert.ToDouble( rs[ name ] ); } ! /// <summary></summary> ! public override System.Type ReturnedClass ! { ! get { return typeof( double ); } } ! /// <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 "Double"; } } ! /// <summary> ! /// ! /// </summary> ! /// <param name="value"></param> ! /// <returns></returns> ! public override string ObjectToSQLString( object value ) ! { return value.ToString(); } } ! } \ No newline at end of file Index: DateTimeType.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Type/DateTimeType.cs,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** DateTimeType.cs 25 Oct 2004 05:37:56 -0000 1.12 --- DateTimeType.cs 31 Dec 2004 23:52:20 -0000 1.13 *************** *** 1,8 **** using System; using System.Data; - using NHibernate.SqlTypes; ! namespace NHibernate.Type { /// <summary> --- 1,7 ---- using System; using System.Data; using NHibernate.SqlTypes; ! namespace NHibernate.Type { /// <summary> *************** *** 17,97 **** public class DateTimeType : ValueTypeType, IIdentifierType, ILiteralType, IVersionType { ! ! internal DateTimeType() : base( new DateTimeSqlType() ) { } ! public override object Get(IDataReader rs, int index) { ! DateTime dbValue = Convert.ToDateTime(rs[index]); ! return new DateTime(dbValue.Year, dbValue.Month, dbValue.Day, dbValue.Hour, dbValue.Minute, dbValue.Second); } ! public override object Get(IDataReader rs, string name) { ! return Get(rs,rs.GetOrdinal(name));// rs.[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.DbType = DbType.DateTime; //TODO: figure out if this is a good solution for NULL DATES ! if((DateTime)value<new DateTime(1753,1,1)) { parm.Value = DBNull.Value; } ! else { ! DateTime dateValue = (DateTime)value; ! parm.Value = new DateTime(dateValue.Year, dateValue.Month, dateValue.Day, dateValue.Hour, dateValue.Minute, dateValue.Second); } } ! public override bool Equals(object x, object y) { ! if (x==y) return true; // DateTime can't be null because it is a struct - so comparing // them this way is useless - instead use the magic number... //if (x==null || y==null) return false; ! DateTime date1 = (x==null)? DateTime.MinValue : (DateTime) x; ! DateTime date2 = (y==null)? DateTime.MinValue : (DateTime) y; //return date1.Equals(date2); ! return (date1.Year == date2.Year && date1.Month == date2.Month && date1.Day == date2.Day && date1.Hour == date2.Hour && date1.Minute == date2.Minute && ! date1.Second == date2.Second); } ! public override string Name { get { return "DateTime"; } } ! public override string ToXML(object val) { ! return ((DateTime)val).ToShortDateString(); } ! public override bool HasNiceEquals { get { return true; } } ! public object StringToObject(string xml) { ! return DateTime.Parse(xml); } ! public override string ObjectToSQLString(object value) { return "'" + value.ToString() + "'"; --- 16,141 ---- public class DateTimeType : ValueTypeType, IIdentifierType, ILiteralType, IVersionType { ! /// <summary></summary> ! internal DateTimeType() : base( new DateTimeSqlType() ) { } ! /// <summary> ! /// ! /// </summary> ! /// <param name="rs"></param> ! /// <param name="index"></param> ! /// <returns></returns> ! public override object Get( IDataReader rs, int index ) { ! DateTime dbValue = Convert.ToDateTime( rs[ index ] ); ! return new DateTime( dbValue.Year, dbValue.Month, dbValue.Day, dbValue.Hour, dbValue.Minute, dbValue.Second ); } ! /// <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 ) ); // rs.[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.DbType = DbType.DateTime; //TODO: figure out if this is a good solution for NULL DATES ! if( ( DateTime ) value < new DateTime( 1753, 1, 1 ) ) { parm.Value = DBNull.Value; } ! else { ! DateTime dateValue = ( DateTime ) value; ! parm.Value = new DateTime( dateValue.Year, dateValue.Month, dateValue.Day, dateValue.Hour, dateValue.Minute, dateValue.Second ); } } ! /// <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; ! } // DateTime can't be null because it is a struct - so comparing // them this way is useless - instead use the magic number... //if (x==null || y==null) return false; ! DateTime date1 = ( x == null ) ? DateTime.MinValue : ( DateTime ) x; ! DateTime date2 = ( y == null ) ? DateTime.MinValue : ( DateTime ) y; //return date1.Equals(date2); ! return ( date1.Year == date2.Year && date1.Month == date2.Month && date1.Day == date2.Day && date1.Hour == date2.Hour && date1.Minute == date2.Minute && ! date1.Second == date2.Second ); } ! /// <summary></summary> ! public override string Name { get { return "DateTime"; } } ! /// <summary> ! /// ! /// </summary> ! /// <param name="val"></param> ! /// <returns></returns> ! public override string ToXML( object val ) { ! return ( ( DateTime ) val ).ToShortDateString(); } ! /// <summary></summary> ! public override bool HasNiceEquals { get { return true; } } ! /// <summary> ! /// ! /// </summary> ! /// <param name="xml"></param> ! /// <returns></returns> ! public object StringToObject( string xml ) { ! return DateTime.Parse( xml ); } ! /// <summary> ! /// ! /// </summary> ! /// <param name="value"></param> ! /// <returns></returns> ! public override string ObjectToSQLString( object value ) { return "'" + value.ToString() + "'"; *************** *** 100,109 **** #region IVersionType Members ! public object Next(object current) { return Seed; } ! ! public object Seed { get { return DateTime.Now; } --- 144,159 ---- #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; } *************** *** 111,115 **** #endregion - } ! } --- 161,164 ---- #endregion } ! } \ No newline at end of file Index: CustomType.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Type/CustomType.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** CustomType.cs 10 Feb 2004 18:41:42 -0000 1.3 --- CustomType.cs 31 Dec 2004 23:52:20 -0000 1.4 *************** *** 1,83 **** using System; - using System.Reflection; using System.Data; ! using log4net; using NHibernate.Engine; using NHibernate.SqlTypes; ! namespace NHibernate.Type { ! /// <summary> /// Adapts IUserType to the generic IType interface. ! /// <seealso cref="NHibernate.IUserType"/> /// </summary> ! public class CustomType : AbstractType { ! private readonly IUserType userType; private readonly string name; ! private readonly SqlType[] sqlTypes; ! protected IUserType UserType { ! get { ! return userType; ! } } ! public CustomType(System.Type userTypeClass) { name = userTypeClass.Name; ! try { ! userType = (IUserType) Activator.CreateInstance(userTypeClass); } ! catch (ArgumentNullException ane) { throw new MappingException( "Argument is a null reference.", ane ); } ! catch (ArgumentException ae) { throw new MappingException( "Argument " + userTypeClass.Name + " is not a RuntimeType", ae ); } ! catch (TargetInvocationException tie) { throw new MappingException( "The constructor being called throws an exception.", tie ); } ! catch (MethodAccessException mae) { throw new MappingException( "The caller does not have permission to call this constructor.", mae ); } ! catch (MissingMethodException mme) { throw new MappingException( "No matching constructor was found.", mme ); } ! catch (InvalidCastException ice) { throw new MappingException( userTypeClass.Name + " must implement NHibernate.IUserType", ice ); } sqlTypes = userType.SqlTypes; ! if ( !userType.ReturnedType.IsSerializable ) { ! LogManager.GetLogger(typeof(CustomType)).Warn("custom type is not Serializable: " + userTypeClass); } } ! ! public override SqlType[] SqlTypes(IMapping mapping) { return sqlTypes; } ! public override int GetColumnSpan(IMapping session) { return sqlTypes.Length; } ! ! public override System.Type ReturnedClass { get { return userType.ReturnedType; } } ! ! public override bool Equals(object x, object y) { ! return userType.Equals(x, y); } ! public override object NullSafeGet( IDataReader rs, ! string[] names, ISessionImplementor session, object owner ! ) { ! return userType.NullSafeGet(rs, names, owner); } ! public override object NullSafeGet( IDataReader rs, --- 1,133 ---- using System; using System.Data; ! using System.Reflection; using log4net; using NHibernate.Engine; using NHibernate.SqlTypes; ! namespace NHibernate.Type ! { /// <summary> /// Adapts IUserType to the generic IType interface. ! /// <seealso cref="IUserType"/> /// </summary> ! public class CustomType : AbstractType ! { private readonly IUserType userType; private readonly string name; ! private readonly SqlType[ ] sqlTypes; ! /// <summary></summary> ! protected IUserType UserType ! { ! get { return userType; } } ! /// <summary> ! /// ! /// </summary> ! /// <param name="userTypeClass"></param> ! public CustomType( System.Type userTypeClass ) ! { name = userTypeClass.Name; ! try ! { ! userType = ( IUserType ) Activator.CreateInstance( userTypeClass ); } ! catch( ArgumentNullException ane ) ! { throw new MappingException( "Argument is a null reference.", ane ); } ! catch( ArgumentException ae ) ! { throw new MappingException( "Argument " + userTypeClass.Name + " is not a RuntimeType", ae ); } ! catch( TargetInvocationException tie ) ! { throw new MappingException( "The constructor being called throws an exception.", tie ); } ! catch( MethodAccessException mae ) ! { throw new MappingException( "The caller does not have permission to call this constructor.", mae ); } ! catch( MissingMethodException mme ) ! { throw new MappingException( "No matching constructor was found.", mme ); } ! catch( InvalidCastException ice ) ! { throw new MappingException( userTypeClass.Name + " must implement NHibernate.IUserType", ice ); } sqlTypes = userType.SqlTypes; ! if( !userType.ReturnedType.IsSerializable ) ! { ! LogManager.GetLogger( typeof( CustomType ) ).Warn( "custom type is not Serializable: " + userTypeClass ); } } ! ! /// <summary> ! /// ! /// </summary> ! /// <param name="mapping"></param> ! /// <returns></returns> ! public override SqlType[ ] SqlTypes( IMapping mapping ) ! { return sqlTypes; } ! /// <summary> ! /// ! /// </summary> ! /// <param name="session"></param> ! /// <returns></returns> ! public override int GetColumnSpan( IMapping session ) ! { return sqlTypes.Length; } ! ! /// <summary></summary> ! public override System.Type ReturnedClass ! { get { return userType.ReturnedType; } } ! ! /// <summary> ! /// ! /// </summary> ! /// <param name="x"></param> ! /// <param name="y"></param> ! /// <returns></returns> ! public override bool Equals( object x, object y ) ! { ! return userType.Equals( x, y ); } ! ! /// <summary> ! /// ! /// </summary> ! /// <param name="rs"></param> ! /// <param name="names"></param> ! /// <param name="session"></param> ! /// <param name="owner"></param> ! /// <returns></returns> public override object NullSafeGet( IDataReader rs, ! string[ ] names, ISessionImplementor session, object owner ! ) ! { ! return userType.NullSafeGet( rs, names, owner ); } ! ! /// <summary> ! /// ! /// </summary> ! /// <param name="rs"></param> ! /// <param name="name"></param> ! /// <param name="session"></param> ! /// <param name="owner"></param> ! /// <returns></returns> public override object NullSafeGet( IDataReader rs, *************** *** 85,92 **** ISessionImplementor session, object owner ! ) { ! return NullSafeGet(rs, new string[] { name }, session, owner); } ! public override void NullSafeSet( IDbCommand cmd, --- 135,150 ---- ISessionImplementor session, object owner ! ) ! { ! return NullSafeGet( rs, new string[ ] {name}, session, owner ); } ! ! /// <summary> ! /// ! /// </summary> ! /// <param name="cmd"></param> ! /// <param name="value"></param> ! /// <param name="index"></param> ! /// <param name="session"></param> public override void NullSafeSet( IDbCommand cmd, *************** *** 94,118 **** int index, ISessionImplementor session ! ) { ! userType.NullSafeSet(cmd, value, index); } ! ! public override string ToXML(object value, ISessionFactoryImplementor factory) { return value.ToString(); } ! ! public override string Name { get { return name; } } ! ! public override object DeepCopy(object value) { ! return userType.DeepCopy(value); } ! ! public override bool IsMutable { get { return userType.IsMutable; } } ! ! public override bool HasNiceEquals { get { return false; } } --- 152,196 ---- int index, ISessionImplementor session ! ) ! { ! userType.NullSafeSet( cmd, value, index ); } ! ! /// <summary> ! /// ! /// </summary> ! /// <param name="value"></param> ! /// <param name="factory"></param> ! /// <returns></returns> ! public override string ToXML( object value, ISessionFactoryImplementor factory ) ! { return value.ToString(); } ! ! /// <summary></summary> ! public override string Name ! { get { return name; } } ! ! /// <summary> ! /// ! /// </summary> ! /// <param name="value"></param> ! /// <returns></returns> ! public override object DeepCopy( object value ) ! { ! return userType.DeepCopy( value ); } ! ! /// <summary></summary> ! public override bool IsMutable ! { get { return userType.IsMutable; } } ! ! /// <summary></summary> ! public override bool HasNiceEquals ! { get { return false; } } Index: DecimalType.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Type/DecimalType.cs,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** DecimalType.cs 25 Oct 2004 05:37:56 -0000 1.7 --- DecimalType.cs 31 Dec 2004 23:52:20 -0000 1.8 *************** *** 1,10 **** using System; using System.Data; - using NHibernate.SqlTypes; ! namespace NHibernate.Type { - /// <summary> /// Maps a <see cref="System.Decimal"/> Property --- 1,8 ---- using System; using System.Data; using NHibernate.SqlTypes; ! namespace NHibernate.Type { /// <summary> /// Maps a <see cref="System.Decimal"/> Property *************** *** 13,56 **** public class DecimalType : ValueTypeType, IIdentifierType { ! internal DecimalType() : this( new DecimalSqlType() ) { } ! ! internal DecimalType(DecimalSqlType sqlType) : base(sqlType) { } ! public override object Get(IDataReader rs, int index) { ! return Convert.ToDecimal(rs[index]); } ! public override object Get(IDataReader rs, string name) { ! return Convert.ToDecimal(rs[name]); } ! public override System.Type ReturnedClass { ! get { return typeof(Decimal); } } ! 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 "Decimal"; } } ! public object StringToObject(string xml) { ! return long.Parse(xml); } ! public override string ObjectToSQLString(object value) { return value.ToString(); --- 11,89 ---- public class DecimalType : ValueTypeType, IIdentifierType { ! /// <summary></summary> ! internal DecimalType() : this( new DecimalSqlType() ) { } ! ! /// <summary> ! /// ! /// </summary> ! /// <param name="sqlType"></param> ! internal DecimalType( DecimalSqlType 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.ToDecimal( rs[ index ] ); } ! /// <summary> ! /// ! /// </summary> ! /// <param name="rs"></param> ! /// <param name="name"></param> ! /// <returns></returns> ! public override object Get( IDataReader rs, string name ) { ! return Convert.ToDecimal( rs[ name ] ); } ! /// <summary></summary> ! public override System.Type ReturnedClass { ! get { return typeof( Decimal ); } } ! /// <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 "Decimal"; } } ! /// <summary> ! /// ! /// </summary> ! /// <param name="xml"></param> ! /// <returns></returns> ! public object StringToObject( string xml ) { ! return long.Parse( xml ); } ! /// <summary> ! /// ! /// </summary> ! /// <param name="value"></param> ! /// <returns></returns> ! public override string ObjectToSQLString( object value ) { return value.ToString(); Index: DateType.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Type/DateType.cs,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** DateType.cs 25 Oct 2004 05:37:56 -0000 1.12 --- DateType.cs 31 Dec 2004 23:52:20 -0000 1.13 *************** *** 3,45 **** using NHibernate.SqlTypes; ! namespace NHibernate.Type { - /// <summary> /// Maps the Year, Month, and Day of a <see cref="System.DateTime"/> Property to a /// <see cref="DbType.Date"/> column /// </summary> ! public class DateType : ValueTypeType, IIdentifierType, ILiteralType { ! ! internal DateType() : base( new DateSqlType() ) { } ! public override object Get(IDataReader rs, int index) { ! DateTime dbValue = Convert.ToDateTime(rs[index]); ! return new DateTime(dbValue.Year, dbValue.Month, dbValue.Day); } ! 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; ! if((DateTime)value<new DateTime(1753,1,1)) { parm.Value = DBNull.Value; } ! else { - parm.DbType = DbType.Date; parm.Value = value; --- 3,63 ---- using NHibernate.SqlTypes; ! namespace NHibernate.Type { /// <summary> /// Maps the Year, Month, and Day of a <see cref="System.DateTime"/> Property to a /// <see cref="DbType.Date"/> column /// </summary> ! public class DateType : ValueTypeType, IIdentifierType, ILiteralType { ! /// <summary></summary> ! internal DateType() : base( new DateSqlType() ) { } ! /// <summary> ! /// ! /// </summary> ! /// <param name="rs"></param> ! /// <param name="index"></param> ! /// <returns></returns> ! public override object Get( IDataReader rs, int index ) { ! DateTime dbValue = Convert.ToDateTime( rs[ index ] ); ! return new DateTime( dbValue.Year, dbValue.Month, dbValue.Day ); } ! /// <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; ! if( ( DateTime ) value < new DateTime( 1753, 1, 1 ) ) { parm.Value = DBNull.Value; } ! else { parm.DbType = DbType.Date; parm.Value = value; *************** *** 47,81 **** } ! public override bool Equals(object x, object y) { ! if (x==y) return true; ! if (x==null || y==null) return false; ! DateTime date1 = (DateTime) x; ! DateTime date2 = (DateTime) y; return date1.Day == date2.Day ! && date1.Month == date2.Month && date1.Year == date2.Year; } ! public override string Name { get { return "Date"; } } ! public override string ToXML(object val) { ! return ((DateTime)val).ToShortDateString(); } ! public override bool HasNiceEquals { get { return true; } } ! public object StringToObject(string xml) { ! return DateTime.Parse(xml); } ! public override string ObjectToSQLString(object value) { ! return "'" + ((DateTime)value).ToShortDateString() + "'"; } } ! } --- 65,134 ---- } ! /// <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; ! } ! DateTime date1 = ( DateTime ) x; ! DateTime date2 = ( DateTime ) y; return date1.Day == date2.Day ! && date1.Month == date2.Month && date1.Year == date2.Year; } ! /// <summary></summary> ! public override string Name ! { get { return "Date"; } } ! /// <summary> ! /// ! /// </summary> ! /// <param name="val"></param> ! /// <returns></returns> ! public override string ToXML( object val ) ! { ! return ( ( DateTime ) val ).ToShortDateString(); } ! /// <summary></summary> ! public override bool HasNiceEquals ! { get { return true; } } ! /// <summary> ! /// ! /// </summary> ! /// <param name="xml"></param> ! /// <returns></returns> ! public object StringToObject( string xml ) ! { ! return DateTime.Parse( xml ); } ! /// <summary> ! /// ! /// </summary> ! /// <param name="value"></param> ! /// <returns></returns> ! public override string ObjectToSQLString( object value ) ! { ! return "'" + ( ( DateTime ) value ).ToShortDateString() + "'"; } } ! } \ No newline at end of file |