From: Kevin W. <kev...@us...> - 2004-12-31 23:54:51
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Type In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24573 Modified Files: ListType.cs ManyToOneType.cs MapType.cs MutableType.cs NullableType.cs Log Message: fixing xml comments and letting ReSharper do reformatting Index: MutableType.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Type/MutableType.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** MutableType.cs 14 Oct 2004 04:33:15 -0000 1.5 --- MutableType.cs 31 Dec 2004 23:54:40 -0000 1.6 *************** *** 1,4 **** - using System; - using NHibernate.SqlTypes; --- 1,2 ---- *************** *** 8,12 **** /// Superclass for mutable nullable types. /// </summary> ! public abstract class MutableType : NullableType { /// <summary> --- 6,10 ---- /// Superclass for mutable nullable types. /// </summary> ! public abstract class MutableType : NullableType { /// <summary> *************** *** 15,19 **** /// </summary> /// <param name="sqlType">The underlying <see cref="SqlType"/>.</param> ! protected MutableType(SqlType sqlType) : base(sqlType) { } --- 13,17 ---- /// </summary> /// <param name="sqlType">The underlying <see cref="SqlType"/>.</param> ! protected MutableType( SqlType sqlType ) : base( sqlType ) { } *************** *** 27,35 **** /// the type is immutable then they should inherit from <see cref="ImmutableType"/>. /// </remarks> ! public override sealed bool IsMutable { get { return true; } } ! /// <summary> --- 25,33 ---- /// the type is immutable then they should inherit from <see cref="ImmutableType"/>. /// </remarks> ! public override sealed bool IsMutable { get { return true; } } ! /// <summary> *************** *** 46,50 **** /// the <c>Equals()</c> then set this to <c>true</c>. /// </remarks> ! public override bool HasNiceEquals { get { return false; } //default ... may be overridden } --- 44,49 ---- /// the <c>Equals()</c> then set this to <c>true</c>. /// </remarks> ! public override bool HasNiceEquals ! { get { return false; } //default ... may be overridden } Index: MapType.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Type/MapType.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** MapType.cs 1 Jun 2004 01:36:11 -0000 1.4 --- MapType.cs 31 Dec 2004 23:54:40 -0000 1.5 *************** *** 1,41 **** - using System; - using System.Data; using System.Collections; using NHibernate.Collection; using NHibernate.Engine; ! namespace NHibernate.Type { ! ! public class MapType : PersistentCollectionType { ! ! public MapType(string role) : base(role) { } ! public override PersistentCollection Instantiate(ISessionImplementor session, CollectionPersister persister) { ! return new Map(session); } ! public override System.Type ReturnedClass { ! get { return typeof(IDictionary); } } ! public override ICollection GetElementsCollection(object collection) { ! return ((IDictionary) collection).Values; } ! public override PersistentCollection Wrap(ISessionImplementor session, object collection) { ! return new Map( session, (IDictionary) collection ); } public override PersistentCollection AssembleCachedCollection( ISessionImplementor session, CollectionPersister persister, object disassembled, ! object owner) { ! ! return new Map(session, persister, disassembled, owner); } } ! } --- 1,73 ---- using System.Collections; using NHibernate.Collection; using NHibernate.Engine; ! namespace NHibernate.Type ! { ! /// <summary></summary> ! public class MapType : PersistentCollectionType ! { ! /// <summary> ! /// ! /// </summary> ! /// <param name="role"></param> ! public MapType( string role ) : base( role ) ! { } ! /// <summary> ! /// ! /// </summary> ! /// <param name="session"></param> ! /// <param name="persister"></param> ! /// <returns></returns> ! public override PersistentCollection Instantiate( ISessionImplementor session, CollectionPersister persister ) ! { ! return new Map( session ); } ! /// <summary></summary> ! public override System.Type ReturnedClass ! { ! get { return typeof( IDictionary ); } } ! /// <summary> ! /// ! /// </summary> ! /// <param name="collection"></param> ! /// <returns></returns> ! public override ICollection GetElementsCollection( object collection ) { ! return ( ( IDictionary ) collection ).Values; } ! /// <summary> ! /// ! /// </summary> ! /// <param name="session"></param> ! /// <param name="collection"></param> ! /// <returns></returns> ! public override PersistentCollection Wrap( ISessionImplementor session, object collection ) { ! return new Map( session, ( IDictionary ) collection ); } + /// <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 Map( session, persister, disassembled, owner ); } } ! } \ No newline at end of file Index: NullableType.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Type/NullableType.cs,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** NullableType.cs 21 Nov 2004 22:56:31 -0000 1.12 --- NullableType.cs 31 Dec 2004 23:54:40 -0000 1.13 *************** *** 1,8 **** using System; using System.Data; ! ! using NHibernate.SqlTypes; using NHibernate.Engine; ! using NHibernate.Util; namespace NHibernate.Type --- 1,7 ---- using System; using System.Data; ! using log4net; using NHibernate.Engine; ! using NHibernate.SqlTypes; namespace NHibernate.Type *************** *** 16,22 **** /// the Struct will be written to the column - not <c>null</c>. /// </remarks> ! public abstract class NullableType : AbstractType { ! private static readonly log4net.ILog log = log4net.LogManager.GetLogger( typeof(NullableType) ); private SqlType _sqlType; --- 15,21 ---- /// the Struct will be written to the column - not <c>null</c>. /// </remarks> ! public abstract class NullableType : AbstractType { ! private static readonly ILog log = LogManager.GetLogger( typeof( NullableType ) ); private SqlType _sqlType; *************** *** 28,32 **** /// <param name="sqlType">The underlying <see cref="SqlType"/>.</param> /// <remarks>This is used when the Property is mapped to a single column.</remarks> ! protected NullableType(SqlType sqlType) { _sqlType = sqlType; --- 27,31 ---- /// <param name="sqlType">The underlying <see cref="SqlType"/>.</param> /// <remarks>This is used when the Property is mapped to a single column.</remarks> ! protected NullableType( SqlType sqlType ) { _sqlType = sqlType; *************** *** 45,49 **** /// it has checked for nulls. /// </remarks> ! public abstract void Set(IDbCommand cmd, object value, int index); /// <summary> --- 44,48 ---- /// it has checked for nulls. /// </remarks> ! public abstract void Set( IDbCommand cmd, object value, int index ); /// <summary> *************** *** 54,59 **** /// <param name="index">The index of the field to get the value from.</param> /// <returns>An object with the value from the database.</returns> ! public abstract object Get(IDataReader rs, int index); ! /// <summary> /// When implemented by a class, gets the object in the --- 53,58 ---- /// <param name="index">The index of the field to get the value from.</param> /// <returns>An object with the value from the database.</returns> ! public abstract object Get( IDataReader rs, int index ); ! /// <summary> /// When implemented by a class, gets the object in the *************** *** 64,73 **** /// <returns>An object with the value from the database.</returns> /// <remarks> ! /// Most implementors just call the <see cref="Get(IDataReader, Int32)"/> /// overload of this method. /// </remarks> ! public abstract object Get(IDataReader rs, string name); - /// <summary> /// A representation of the value to be embedded in an XML element --- 63,72 ---- /// <returns>An object with the value from the database.</returns> /// <remarks> ! /// Most implementors just call the <see cref="Get(IDataReader, int)"/> /// overload of this method. /// </remarks> ! public abstract object Get( IDataReader rs, string name ); ! /// <summary> /// A representation of the value to be embedded in an XML element *************** *** 76,80 **** /// </param> /// <returns>An Xml formatted string.</returns> ! public abstract string ToXML(object val); /// <include file='IType.cs.xmldoc' --- 75,79 ---- /// </param> /// <returns>An Xml formatted string.</returns> ! public abstract string ToXML( object val ); /// <include file='IType.cs.xmldoc' *************** *** 83,87 **** /// <remarks> /// <para> ! /// This implemenation forwards the call to <see cref="ToXML(Object)"/> if the parameter /// value is not null. /// </para> --- 82,86 ---- /// <remarks> /// <para> ! /// This implemenation forwards the call to <see cref="ToXML(object)"/> if the parameter /// value is not null. /// </para> *************** *** 89,100 **** /// It has been "sealed" because the Types inheriting from <see cref="NullableType"/> /// do not need and should not override this method. All of their implementation ! /// should be in <see cref="ToXML(Object)"/>. /// </para> /// </remarks> ! public override sealed string ToXML(object value, ISessionFactoryImplementor pc) { ! return (value==null) ? null : ToXML(value); } ! /// <include file='IType.cs.xmldoc' /// path='//members[@type="IType"]/member[@name="M:IType.NullSafeSet"]/*' --- 88,99 ---- /// It has been "sealed" because the Types inheriting from <see cref="NullableType"/> /// do not need and should not override this method. All of their implementation ! /// should be in <see cref="ToXML(object)"/>. /// </para> /// </remarks> ! public override sealed string ToXML( object value, ISessionFactoryImplementor factory ) { ! return ( value == null ) ? null : ToXML( value ); } ! /// <include file='IType.cs.xmldoc' /// path='//members[@type="IType"]/member[@name="M:IType.NullSafeSet"]/*' *************** *** 102,116 **** /// <remarks> /// <para> ! /// This implemenation forwards the call to <see cref="NullSafeSet(IDbCommand, Object, Int32)" />. /// </para> /// <para> /// It has been "sealed" because the Types inheriting from <see cref="NullableType"/> /// do not need to and should not override this method. All of their implementation ! /// should be in <see cref="NullSafeSet(IDbCommand, Object, Int32)" />. /// </para> /// </remarks> ! public override sealed void NullSafeSet(IDbCommand cmd, object value, int index, ISessionImplementor session) { ! NullSafeSet(cmd, value, index); } --- 101,115 ---- /// <remarks> /// <para> ! /// This implemenation forwards the call to <see cref="NullSafeSet(IDbCommand, object, int)" />. /// </para> /// <para> /// It has been "sealed" because the Types inheriting from <see cref="NullableType"/> /// do not need to and should not override this method. All of their implementation ! /// should be in <see cref="NullSafeSet(IDbCommand, object, int)" />. /// </para> /// </remarks> ! public override sealed void NullSafeSet( IDbCommand st, object value, int index, ISessionImplementor session ) { ! NullSafeSet( st, value, index ); } *************** *** 127,160 **** /// </para> /// <para> ! /// If the value is not null, then the method <see cref="Set(IDbCommand, Object, Int32)"/> /// is called and that method is responsible for setting the value. /// </para> /// </remarks> ! public void NullSafeSet(IDbCommand cmd, object value, int index) { ! if (value==null) { ! if ( log.IsDebugEnabled ) { ! log.Debug("binding null to parameter: " + index.ToString()); } ! //Do we check IsNullable? // TODO: find out why a certain Parameter would not take a null value... // From reading the .NET SDK the default is to NOT accept a null value. ! // I definitely need to look into this more... ! ( (IDataParameter)cmd.Parameters[index]).Value = DBNull.Value; } ! else { ! if ( log.IsDebugEnabled ) { ! log.Debug("binding '" + ToXML(value) + "' to parameter: " + index); } ! ! Set(cmd, value, index); } } ! /// <include file='IType.cs.xmldoc' /// path='//members[@type="IType"]/member[@name="M:IType.NullSafeGet(IDataReader, String[], ISessionImplementor, Object)"]/*' --- 126,159 ---- /// </para> /// <para> ! /// If the value is not null, then the method <see cref="Set(IDbCommand, object, int)"/> /// is called and that method is responsible for setting the value. /// </para> /// </remarks> ! public void NullSafeSet( IDbCommand cmd, object value, int index ) { ! if( value == null ) { ! if( log.IsDebugEnabled ) { ! log.Debug( "binding null to parameter: " + index.ToString() ); } ! //Do we check IsNullable? // TODO: find out why a certain Parameter would not take a null value... // From reading the .NET SDK the default is to NOT accept a null value. ! // I definitely need to look into this more... ! ( ( IDataParameter ) cmd.Parameters[ index ] ).Value = DBNull.Value; } ! else { ! if( log.IsDebugEnabled ) { ! log.Debug( "binding '" + ToXML( value ) + "' to parameter: " + index ); } ! ! Set( cmd, value, index ); } } ! /// <include file='IType.cs.xmldoc' /// path='//members[@type="IType"]/member[@name="M:IType.NullSafeGet(IDataReader, String[], ISessionImplementor, Object)"]/*' *************** *** 166,172 **** /// safe thing to do because a Nullable Type only has one field. /// </remarks> ! public override sealed object NullSafeGet(IDataReader rs, string[] names, ISessionImplementor session, object owner) { ! return NullSafeGet(rs, names[0]); } --- 165,171 ---- /// safe thing to do because a Nullable Type only has one field. /// </remarks> ! public override sealed object NullSafeGet( IDataReader rs, string[ ] names, ISessionImplementor session, object owner ) { ! return NullSafeGet( rs, names[ 0 ] ); } *************** *** 186,192 **** /// TODO: determine if this is needed /// </remarks> ! public virtual object NullSafeGet(IDataReader rs, string[] names) { ! return NullSafeGet(rs, names[0]); } --- 185,191 ---- /// TODO: determine if this is needed /// </remarks> ! public virtual object NullSafeGet( IDataReader rs, string[ ] names ) { ! return NullSafeGet( rs, names[ 0 ] ); } *************** *** 207,219 **** /// </para> /// </remarks> ! public virtual object NullSafeGet(IDataReader rs, string name) { ! int index = rs.GetOrdinal(name); ! if( rs.IsDBNull(index) ) { ! if ( log.IsDebugEnabled ) { ! log.Debug("returning null as column: " + name); } // TODO: add a method to NullableType.GetNullValue - if we want to --- 206,218 ---- /// </para> /// </remarks> ! public virtual object NullSafeGet( IDataReader rs, string name ) { ! int index = rs.GetOrdinal( name ); ! if( rs.IsDBNull( index ) ) { ! if( log.IsDebugEnabled ) { ! log.Debug( "returning null as column: " + name ); } // TODO: add a method to NullableType.GetNullValue - if we want to *************** *** 221,243 **** return null; } ! else ! { object val = null; ! try { ! val = Get(rs, index); } ! catch(System.InvalidCastException ice) { throw new ADOException( ! "Could not cast the value in field " + name + " to the Type " + this.GetType().Name + ! ". Please check to make sure that the mapping is correct and that your DataProvider supports this Data Type.", ice); } ! ! if ( log.IsDebugEnabled ) { ! log.Debug("returning '" + ToXML(val) + "' as column: " + name); } ! return val; } --- 220,242 ---- return null; } ! else ! { object val = null; ! try { ! val = Get( rs, index ); } ! catch( InvalidCastException ice ) { throw new ADOException( ! "Could not cast the value in field " + name + " to the Type " + this.GetType().Name + ! ". Please check to make sure that the mapping is correct and that your DataProvider supports this Data Type.", ice ); } ! ! if( log.IsDebugEnabled ) { ! log.Debug( "returning '" + ToXML( val ) + "' as column: " + name ); } ! return val; } *************** *** 258,266 **** /// </para> /// </remarks> ! public override sealed object NullSafeGet(IDataReader rs, string name, ISessionImplementor session, object owner) { ! return NullSafeGet(rs, name); } ! /// <summary> /// Gets the underlying <see cref="SqlType" /> for --- 257,265 ---- /// </para> /// </remarks> ! public override sealed object NullSafeGet( IDataReader rs, string name, ISessionImplementor session, object owner ) { ! return NullSafeGet( rs, name ); } ! /// <summary> /// Gets the underlying <see cref="SqlType" /> for *************** *** 273,279 **** /// that override this Property. /// </remarks> ! public virtual SqlType SqlType { ! get {return _sqlType;} } --- 272,278 ---- /// that override this Property. /// </remarks> ! public virtual SqlType SqlType { ! get { return _sqlType; } } *************** *** 291,297 **** /// </para> /// </remarks> ! public override sealed SqlType[] SqlTypes(IMapping session) { ! return new SqlType[] {SqlType}; } --- 290,296 ---- /// </para> /// </remarks> ! public override sealed SqlType[ ] SqlTypes( IMapping mapping ) { ! return new SqlType[ ] {SqlType}; } *************** *** 304,313 **** /// a NullableType can only map to one column in a table. /// </remarks> ! public override sealed int GetColumnSpan(IMapping session) { return 1; } ! /// <summary> /// When implemented by a class, returns a deep copy of the persistent state. --- 303,313 ---- /// a NullableType can only map to one column in a table. /// </remarks> ! public override sealed int GetColumnSpan( IMapping session ) { return 1; } ! ! /* <see cref="NullableTypes"/> */ /// <summary> /// When implemented by a class, returns a deep copy of the persistent state. *************** *** 316,324 **** /// <returns>A deep copy of the object.</returns> /// <remarks> ! /// Most of the built in <see cref="NullableTypes"/> will just return the same object /// passed into it. /// </remarks> ! public abstract object DeepCopyNotNull(object val); ! /// <include file='IType.cs.xmldoc' /// path='//members[@type="IType"]/member[@name="M:IType.DeepCopy"]/*' --- 316,324 ---- /// <returns>A deep copy of the object.</returns> /// <remarks> ! /// Most of the built in NullableTypes will just return the same object /// passed into it. /// </remarks> ! public abstract object DeepCopyNotNull( object val ); ! /// <include file='IType.cs.xmldoc' /// path='//members[@type="IType"]/member[@name="M:IType.DeepCopy"]/*' *************** *** 335,344 **** /// </para> /// </remarks> ! public override sealed object DeepCopy(object val) { ! return (val==null) ? null : DeepCopyNotNull(val); } - #region override of System.Object Members --- 335,343 ---- /// </para> /// </remarks> ! public override sealed object DeepCopy( object val ) { ! return ( val == null ) ? null : DeepCopyNotNull( val ); } #region override of System.Object Members *************** *** 349,353 **** /// <param name="obj">The <see cref="Object"/> to compare with this NullableType.</param> /// <returns>true if the SqlType and Name properties are the same.</returns> ! public override bool Equals(object obj) { /* * Step 1: Perform an == test --- 348,353 ---- /// <param name="obj">The <see cref="Object"/> to compare with this NullableType.</param> /// <returns>true if the SqlType and Name properties are the same.</returns> ! public override bool Equals( object obj ) ! { /* * Step 1: Perform an == test *************** *** 357,374 **** * Step 5: Go back to equals()'s contract and ask yourself if the equals() * method is reflexive, symmetric, and transitive ! */ ! if(this==obj) return true; NullableType rhsType = obj as NullableType; ! if(rhsType==null) return false; ! if(this.Name.Equals(rhsType.Name) ! && this.SqlType.Equals(rhsType.SqlType)) return true; return false; } ! /// <summary> /// Serves as a hash function for the <see cref="NullableType"/>, --- 357,383 ---- * Step 5: Go back to equals()'s contract and ask yourself if the equals() * method is reflexive, symmetric, and transitive ! */ ! if( this == obj ) ! { ! return true; ! } NullableType rhsType = obj as NullableType; ! if( rhsType == null ) ! { ! return false; ! } ! if( this.Name.Equals( rhsType.Name ) ! && this.SqlType.Equals( rhsType.SqlType ) ) ! { ! return true; ! } return false; } ! /// <summary> /// Serves as a hash function for the <see cref="NullableType"/>, *************** *** 377,389 **** /// <returns> /// A hash code that is based on the <see cref="NullableType.SqlType"/>'s ! /// hash code and the <see cref="NullableType.Name"/>'s hash code.</returns> ! public override int GetHashCode() { ! ! return (SqlType.GetHashCode() / 2) + (Name.GetHashCode() / 2); } #endregion - } } \ No newline at end of file --- 386,397 ---- /// <returns> /// A hash code that is based on the <see cref="NullableType.SqlType"/>'s ! /// hash code and the <see cref="AbstractType.Name"/>'s hash code.</returns> ! public override int GetHashCode() ! { ! return ( SqlType.GetHashCode()/2 ) + ( Name.GetHashCode()/2 ); } #endregion } } \ No newline at end of file Index: ListType.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Type/ListType.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ListType.cs 10 Feb 2004 18:41:42 -0000 1.4 --- ListType.cs 31 Dec 2004 23:54:40 -0000 1.5 *************** *** 1,34 **** - using System; using System.Collections; using NHibernate.Collection; using NHibernate.Engine; ! namespace NHibernate.Type { ! ! public class ListType : PersistentCollectionType { ! ! public ListType(string role) : base(role) { } ! public override PersistentCollection Instantiate(ISessionImplementor session, CollectionPersister persister) { ! return new List(session); } ! public override System.Type ReturnedClass { ! get { return typeof(IList); } } ! public override PersistentCollection Wrap(ISessionImplementor session, object collection) { ! return new List( session, (IList) collection ); } public override PersistentCollection AssembleCachedCollection( ISessionImplementor session, CollectionPersister persister, object disassembled, ! object owner) { ! ! return new List(session, persister, disassembled, owner); } } ! } --- 1,63 ---- using System.Collections; using NHibernate.Collection; using NHibernate.Engine; ! namespace NHibernate.Type ! { ! /// <summary></summary> ! public class ListType : PersistentCollectionType ! { ! /// <summary> ! /// ! /// </summary> ! /// <param name="role"></param> ! public ListType( string role ) : base( role ) ! { } ! /// <summary> ! /// ! /// </summary> ! /// <param name="session"></param> ! /// <param name="persister"></param> ! /// <returns></returns> ! public override PersistentCollection Instantiate( ISessionImplementor session, CollectionPersister persister ) ! { ! return new List( session ); } ! /// <summary></summary> ! public override System.Type ReturnedClass ! { ! get { return typeof( IList ); } } ! /// <summary> ! /// ! /// </summary> ! /// <param name="session"></param> ! /// <param name="collection"></param> ! /// <returns></returns> ! public override PersistentCollection Wrap( ISessionImplementor session, object collection ) ! { ! return new List( session, ( IList ) collection ); } + /// <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 List( session, persister, disassembled, owner ); } } ! } \ No newline at end of file Index: ManyToOneType.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Type/ManyToOneType.cs,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** ManyToOneType.cs 29 Nov 2004 18:43:24 -0000 1.8 --- ManyToOneType.cs 31 Dec 2004 23:54:40 -0000 1.9 *************** *** 1,37 **** - using System; using System.Data; - - using NHibernate.Mapping; using NHibernate.Engine; using NHibernate.SqlTypes; ! namespace NHibernate.Type { ! /// <summary> /// A many-to-one association to an entity /// </summary> ! public class ManyToOneType : EntityType, IAssociationType { ! ! public override int GetColumnSpan(IMapping session) { ! return session.GetIdentifierType( PersistentClass ).GetColumnSpan(session); } ! public override SqlType[] SqlTypes(IMapping session) { ! return session.GetIdentifierType( PersistentClass ).SqlTypes(session); } ! ! public ManyToOneType(System.Type persistentClass) : base(persistentClass) { } ! public override void NullSafeSet(IDbCommand cmd, object value, int index, ISessionImplementor session) { session.Factory.GetIdentifierType( PersistentClass ) ! .NullSafeSet(cmd, GetIdentifier(value, session), index, session); } ! ! public override bool IsOneToOne { get { return false; } } ! public virtual ForeignKeyType ForeignKeyType { get { return ForeignKeyType.ForeignKeyFromParent; } } --- 1,63 ---- using System.Data; using NHibernate.Engine; using NHibernate.SqlTypes; ! namespace NHibernate.Type ! { /// <summary> /// A many-to-one association to an entity /// </summary> ! public class ManyToOneType : EntityType, IAssociationType ! { ! /// <summary> ! /// ! /// </summary> ! /// <param name="session"></param> ! /// <returns></returns> ! public override int GetColumnSpan( IMapping session ) ! { ! return session.GetIdentifierType( PersistentClass ).GetColumnSpan( session ); } ! /// <summary> ! /// ! /// </summary> ! /// <param name="session"></param> ! /// <returns></returns> ! public override SqlType[ ] SqlTypes( IMapping session ) ! { ! return session.GetIdentifierType( PersistentClass ).SqlTypes( session ); } ! ! /// <summary> ! /// ! /// </summary> ! /// <param name="persistentClass"></param> ! public ManyToOneType( System.Type persistentClass ) : base( persistentClass ) ! { } ! /// <summary> ! /// ! /// </summary> ! /// <param name="cmd"></param> ! /// <param name="value"></param> ! /// <param name="index"></param> ! /// <param name="session"></param> ! public override void NullSafeSet( IDbCommand cmd, object value, int index, ISessionImplementor session ) ! { session.Factory.GetIdentifierType( PersistentClass ) ! .NullSafeSet( cmd, GetIdentifier( value, session ), index, session ); } ! ! /// <summary></summary> ! public override bool IsOneToOne ! { get { return false; } } ! /// <summary></summary> ! public virtual ForeignKeyType ForeignKeyType ! { get { return ForeignKeyType.ForeignKeyFromParent; } } *************** *** 47,54 **** /// An instantiated object that used as the identifier of the type. /// </returns> ! public override object Hydrate(IDataReader rs, string[] names, ISessionImplementor session, object owner) { return session.Factory.GetIdentifierType( PersistentClass ) ! .NullSafeGet(rs, names, session, owner); } --- 73,80 ---- /// An instantiated object that used as the identifier of the type. /// </returns> ! public override object Hydrate( IDataReader rs, string[ ] names, ISessionImplementor session, object owner ) { return session.Factory.GetIdentifierType( PersistentClass ) ! .NullSafeGet( rs, names, session, owner ); } *************** *** 63,72 **** /// <c>value</c> is also <c>null</c>. /// </returns> ! public override object ResolveIdentifier(object value, ISessionImplementor session, object owner) { ! if (value==null) { return null; ! } ! else { return session.InternalLoad( PersistentClass, value ); --- 89,99 ---- /// <c>value</c> is also <c>null</c>. /// </returns> ! public override object ResolveIdentifier( object value, ISessionImplementor session, object owner ) ! { ! if( value == null ) { return null; ! } ! else { return session.InternalLoad( PersistentClass, value ); |