From: Michael D. <mik...@us...> - 2004-11-29 18:44:05
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Type In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24621/NHibernate/Type Modified Files: EntityType.cs ManyToOneType.cs Log Message: Added more comments around Enumerable implementation. Index: EntityType.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Type/EntityType.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** EntityType.cs 20 Sep 2004 02:27:01 -0000 1.5 --- EntityType.cs 29 Nov 2004 18:43:23 -0000 1.6 *************** *** 105,109 **** } ! public override sealed object NullSafeGet(IDataReader rs, string[] names, ISessionImplementor session, object owner) { return ResolveIdentifier( Hydrate(rs, names, session, owner), session, owner ); } --- 105,120 ---- } ! /// <summary> ! /// Converts the id contained in the <see cref="IDataReader"/> to an object. ! /// </summary> ! /// <param name="rs">The <see cref="IDataReader"/> that contains the query results.</param> ! /// <param name="names">A string array of column names that contain the id.</param> ! /// <param name="session">The <see cref="ISessionImplementor"/> this is occurring in.</param> ! /// <param name="owner">The object that this Entity will be a part of.</param> ! /// <returns> ! /// An instance of the object or <c>null</c> if the identifer was null. ! /// </returns> ! public override sealed object NullSafeGet(IDataReader rs, string[] names, ISessionImplementor session, object owner) ! { return ResolveIdentifier( Hydrate(rs, names, session, owner), session, owner ); } Index: ManyToOneType.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Type/ManyToOneType.cs,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** ManyToOneType.cs 20 Aug 2004 17:39:01 -0000 1.7 --- ManyToOneType.cs 29 Nov 2004 18:43:24 -0000 1.8 *************** *** 37,49 **** } ! public override object Hydrate(IDataReader rs, string[] names, ISessionImplementor session, object owner) { return session.Factory.GetIdentifierType( PersistentClass ) .NullSafeGet(rs, names, session, owner); } public override object ResolveIdentifier(object value, ISessionImplementor session, object owner) { ! if (value==null) { return null; ! } else { return session.InternalLoad( PersistentClass, value ); } --- 37,73 ---- } ! /// <summary> ! /// Hydrates the Identifier from <see cref="IDataReader"/>. ! /// </summary> ! /// <param name="rs">The <see cref="IDataReader"/> that contains the query results.</param> ! /// <param name="names">A string array of column names to read from.</param> ! /// <param name="session">The <see cref="ISessionImplementor"/> this is occuring in.</param> ! /// <param name="owner">The object that this Entity will be a part of.</param> ! /// <returns> ! /// 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); } + /// <summary> + /// Resolves the Identifier to the actual object. + /// </summary> + /// <param name="value">The identifier object.</param> + /// <param name="session">The <see cref="ISessionImplementor"/> this is occurring in.</param> + /// <param name="owner"></param> + /// <returns> + /// The object that is identified by the parameter <c>value</c> or <c>null</c> if the parameter + /// <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 ); } |