From: <fab...@us...> - 2011-04-26 13:58:22
|
Revision: 5765 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=5765&view=rev Author: fabiomaulo Date: 2011-04-26 13:58:16 +0000 (Tue, 26 Apr 2011) Log Message: ----------- Fix NH-2674 Modified Paths: -------------- trunk/nhibernate/src/NHibernate/Criterion/QueryOver.cs trunk/nhibernate/src/NHibernate/ISession.cs trunk/nhibernate/src/NHibernate/Impl/SessionImpl.cs Modified: trunk/nhibernate/src/NHibernate/Criterion/QueryOver.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Criterion/QueryOver.cs 2011-04-25 23:01:50 UTC (rev 5764) +++ trunk/nhibernate/src/NHibernate/Criterion/QueryOver.cs 2011-04-26 13:58:16 UTC (rev 5765) @@ -31,6 +31,16 @@ return new QueryOver<T,T>(alias); } + public static QueryOver<T, T> Of<T>(string entityName) + { + return new QueryOver<T, T>(entityName); + } + + public static QueryOver<T, T> Of<T>(string entityName, Expression<Func<T>> alias) + { + return new QueryOver<T, T>(entityName, alias); + } + public ICriteria UnderlyingCriteria { get { return criteria; } @@ -275,6 +285,12 @@ criteria = impl; } + protected internal QueryOver(string entityName) + { + impl = new CriteriaImpl(entityName, null); + criteria = impl; + } + protected internal QueryOver(Expression<Func<TSubType>> alias) { string aliasPath = ExpressionProcessor.FindMemberExpression(alias.Body); @@ -282,6 +298,13 @@ criteria = impl; } + protected internal QueryOver(string entityName, Expression<Func<TSubType>> alias) + { + string aliasPath = ExpressionProcessor.FindMemberExpression(alias.Body); + impl = new CriteriaImpl(entityName, aliasPath, null); + criteria = impl; + } + protected internal QueryOver(CriteriaImpl impl) { this.impl = impl; Modified: trunk/nhibernate/src/NHibernate/ISession.cs =================================================================== --- trunk/nhibernate/src/NHibernate/ISession.cs 2011-04-25 23:01:50 UTC (rev 5764) +++ trunk/nhibernate/src/NHibernate/ISession.cs 2011-04-26 13:58:16 UTC (rev 5765) @@ -714,17 +714,35 @@ /// Creates a new <c>IQueryOver<T></c> for the entity class. /// </summary> /// <typeparam name="T">The entity class</typeparam> - /// <returns>An ICriteria<T> object</returns> + /// <returns>An IQueryOver<T> object</returns> IQueryOver<T,T> QueryOver<T>() where T : class; /// <summary> /// Creates a new <c>IQueryOver<T></c> for the entity class. /// </summary> /// <typeparam name="T">The entity class</typeparam> - /// <returns>An ICriteria<T> object</returns> + /// <param name="alias">The alias of the entity</param> + /// <returns>An IQueryOver<T> object</returns> IQueryOver<T,T> QueryOver<T>(Expression<Func<T>> alias) where T : class; /// <summary> + /// Creates a new <c>IQueryOver{T};</c> for the entity class. + /// </summary> + /// <typeparam name="T">The entity class</typeparam> + /// <param name="entityName">The name of the entity to Query</param> + /// <returns>An IQueryOver{T} object</returns> + IQueryOver<T, T> QueryOver<T>(string entityName) where T : class; + + /// <summary> + /// Creates a new <c>IQueryOver{T}</c> for the entity class. + /// </summary> + /// <typeparam name="T">The entity class</typeparam> + /// <param name="entityName">The name of the entity to Query</param> + /// <param name="alias">The alias of the entity</param> + /// <returns>An IQueryOver{T} object</returns> + IQueryOver<T, T> QueryOver<T>(string entityName, Expression<Func<T>> alias) where T : class; + + /// <summary> /// Create a new instance of <c>Query</c> for the given query string /// </summary> /// <param name="queryString">A hibernate query string</param> Modified: trunk/nhibernate/src/NHibernate/Impl/SessionImpl.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Impl/SessionImpl.cs 2011-04-25 23:01:50 UTC (rev 5764) +++ trunk/nhibernate/src/NHibernate/Impl/SessionImpl.cs 2011-04-26 13:58:16 UTC (rev 5765) @@ -1862,6 +1862,25 @@ } } + public IQueryOver<T, T> QueryOver<T>(string entityName) where T : class + { + using (new SessionIdLoggingContext(SessionId)) + { + CheckAndUpdateSessionStatus(); + return new QueryOver<T, T>(new CriteriaImpl(entityName, this)); + } + } + + public IQueryOver<T, T> QueryOver<T>(string entityName, Expression<Func<T>> alias) where T : class + { + using (new SessionIdLoggingContext(SessionId)) + { + CheckAndUpdateSessionStatus(); + string aliasPath = ExpressionProcessor.FindMemberExpression(alias.Body); + return new QueryOver<T, T>(new CriteriaImpl(entityName, aliasPath, this)); + } + } + public override IList List(CriteriaImpl criteria) { using (new SessionIdLoggingContext(SessionId)) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |