From: <ric...@us...> - 2009-07-02 20:55:18
|
Revision: 4561 http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4561&view=rev Author: ricbrown Date: 2009-07-02 20:55:15 +0000 (Thu, 02 Jul 2009) Log Message: ----------- Renamed interface to match class. Modified Paths: -------------- trunk/nhibernate/src/NHibernate/Criterion/QueryOver.cs trunk/nhibernate/src/NHibernate/ISession.cs trunk/nhibernate/src/NHibernate/Impl/SessionImpl.cs trunk/nhibernate/src/NHibernate/NHibernate.csproj trunk/nhibernate/src/NHibernate.Test/Criteria/Lambda/LambdaFixtureBase.cs trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj Added Paths: ----------- trunk/nhibernate/src/NHibernate/IQueryOver.cs trunk/nhibernate/src/NHibernate.Test/Criteria/Lambda/QueryOverFixture.cs Removed Paths: ------------- trunk/nhibernate/src/NHibernate/ICriteriaOfT.cs trunk/nhibernate/src/NHibernate.Test/Criteria/Lambda/CriteriaOfTFixture.cs Modified: trunk/nhibernate/src/NHibernate/Criterion/QueryOver.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Criterion/QueryOver.cs 2009-07-02 04:24:50 UTC (rev 4560) +++ trunk/nhibernate/src/NHibernate/Criterion/QueryOver.cs 2009-07-02 20:55:15 UTC (rev 4561) @@ -10,10 +10,10 @@ { /// <summary> - /// Implementation of the <see cref="ICriteria<T>"/> interface + /// Implementation of the <see cref="IQueryOver<T>"/> interface /// </summary> [Serializable] - public class QueryOver<T> : ICriteria<T> + public class QueryOver<T> : IQueryOver<T> { private ICriteria _criteria; @@ -42,41 +42,41 @@ get { return _criteria; } } - public ICriteria<T> And(Expression<Func<T, bool>> expression) + public IQueryOver<T> And(Expression<Func<T, bool>> expression) { return Add(expression); } - public ICriteria<T> And(Expression<Func<bool>> expression) + public IQueryOver<T> And(Expression<Func<bool>> expression) { return Add(expression); } - public ICriteria<T> Where(Expression<Func<T, bool>> expression) + public IQueryOver<T> Where(Expression<Func<T, bool>> expression) { return Add(expression); } - public ICriteria<T> Where(Expression<Func<bool>> expression) + public IQueryOver<T> Where(Expression<Func<bool>> expression) { return Add(expression); } - public ICriteria<U> JoinWalk<U>(Expression<Func<T, U>> path) + public IQueryOver<U> JoinWalk<U>(Expression<Func<T, U>> path) { return new QueryOver<U>(_impl, _criteria.CreateCriteria( ExpressionProcessor.FindMemberExpression(path.Body))); } - public ICriteria<U> JoinWalk<U>(Expression<Func<T, IEnumerable<U>>> path) + public IQueryOver<U> JoinWalk<U>(Expression<Func<T, IEnumerable<U>>> path) { return new QueryOver<U>(_impl, _criteria.CreateCriteria( ExpressionProcessor.FindMemberExpression(path.Body))); } - public ICriteria<T> Join(Expression<Func<T, object>> path, Expression<Func<object>> alias) + public IQueryOver<T> Join(Expression<Func<T, object>> path, Expression<Func<object>> alias) { return AddAlias( ExpressionProcessor.FindMemberExpression(path.Body), @@ -89,7 +89,7 @@ return _criteria.List<T>(); } - public ICriteria<T> GetExecutableQueryOver(ISession session) + public IQueryOver<T> GetExecutableQueryOver(ISession session) { _impl.Session = session.GetSessionImplementation(); return this; Deleted: trunk/nhibernate/src/NHibernate/ICriteriaOfT.cs =================================================================== --- trunk/nhibernate/src/NHibernate/ICriteriaOfT.cs 2009-07-02 04:24:50 UTC (rev 4560) +++ trunk/nhibernate/src/NHibernate/ICriteriaOfT.cs 2009-07-02 20:55:15 UTC (rev 4561) @@ -1,90 +0,0 @@ - -using System; -using System.Collections.Generic; -using System.Linq.Expressions; - -namespace NHibernate -{ - - /// <summary> - /// Criteria<T> is an API for retrieving entities by composing - /// <see cref="Criterion.Expression" /> objects expressed using Lambda expression syntax. - /// </summary> - /// <remarks> - /// <code> - /// IList<Cat> cats = session.QueryOver<Cat>() - /// .Add( c => c.Name == "Tigger" ) - /// .Add( c => c.Weight > minWeight ) ) - /// .List(); - /// </code> - /// </remarks> - public interface ICriteria<T> - { - - /// <summary> - /// Add criterion expressed as a lambda expression - /// </summary> - /// <param name="expression">Lambda expression</param> - /// <returns>criteria instance</returns> - ICriteria<T> And(Expression<Func<T, bool>> expression); - - /// <summary> - /// Add criterion expressed as a lambda expression - /// </summary> - /// <param name="expression">Lambda expression</param> - /// <returns>criteria instance</returns> - ICriteria<T> And(Expression<Func<bool>> expression); - - /// <summary> - /// Identical semantics to Add() to allow more readable queries - /// </summary> - /// <param name="expression">Lambda expression</param> - /// <returns>criteria instance</returns> - ICriteria<T> Where(Expression<Func<T, bool>> expression); - - /// <summary> - /// Identical semantics to Add() to allow more readable queries - /// </summary> - /// <param name="expression">Lambda expression</param> - /// <returns>criteria instance</returns> - ICriteria<T> Where(Expression<Func<bool>> expression); - - /// <summary> - /// Creates a new NHibernate.ICriteria<T>, "rooted" at the associated entity - /// </summary> - /// <typeparam name="U">Type of sub-criteria</typeparam> - /// <param name="path">Lambda expression returning association path</param> - /// <returns>The created "sub criteria"</returns> - ICriteria<U> JoinWalk<U>(Expression<Func<T, U>> path); - - /// <summary> - /// Creates a new NHibernate.ICriteria<T>, "rooted" at the associated entity - /// specifying a collection for the join. - /// </summary> - /// <typeparam name="U">Type of sub-criteria (type of the collection)</typeparam> - /// <param name="path">Lambda expression returning association path</param> - /// <returns>The created "sub criteria"</returns> - ICriteria<U> JoinWalk<U>(Expression<Func<T, IEnumerable<U>>> path); - - /// <summary> - /// Join an association, assigning an alias to the joined entity - /// </summary> - /// <param name="path">Lambda expression returning association path</param> - /// <param name="alias">Lambda expression returning alias reference</param> - /// <returns>criteria instance</returns> - ICriteria<T> Join(Expression<Func<T, object>> path, Expression<Func<object>> alias); - - /// <summary> - /// Get the results of the root type and fill the <see cref="IList<T>"/> - /// </summary> - /// <returns>The list filled with the results.</returns> - IList<T> List(); - - /// <summary> - /// Get an executable instance of <c>Criteria<T></c>, - /// to actually run the query.</summary> - ICriteria<T> GetExecutableQueryOver(ISession session); - - } - -} Copied: trunk/nhibernate/src/NHibernate/IQueryOver.cs (from rev 4560, trunk/nhibernate/src/NHibernate/ICriteriaOfT.cs) =================================================================== --- trunk/nhibernate/src/NHibernate/IQueryOver.cs (rev 0) +++ trunk/nhibernate/src/NHibernate/IQueryOver.cs 2009-07-02 20:55:15 UTC (rev 4561) @@ -0,0 +1,90 @@ + +using System; +using System.Collections.Generic; +using System.Linq.Expressions; + +namespace NHibernate +{ + + /// <summary> + /// QueryOver<T> is an API for retrieving entities by composing + /// <see cref="Criterion.Expression" /> objects expressed using Lambda expression syntax. + /// </summary> + /// <remarks> + /// <code> + /// IList<Cat> cats = session.QueryOver<Cat>() + /// .Add( c => c.Name == "Tigger" ) + /// .Add( c => c.Weight > minWeight ) ) + /// .List(); + /// </code> + /// </remarks> + public interface IQueryOver<T> + { + + /// <summary> + /// Add criterion expressed as a lambda expression + /// </summary> + /// <param name="expression">Lambda expression</param> + /// <returns>criteria instance</returns> + IQueryOver<T> And(Expression<Func<T, bool>> expression); + + /// <summary> + /// Add criterion expressed as a lambda expression + /// </summary> + /// <param name="expression">Lambda expression</param> + /// <returns>criteria instance</returns> + IQueryOver<T> And(Expression<Func<bool>> expression); + + /// <summary> + /// Identical semantics to Add() to allow more readable queries + /// </summary> + /// <param name="expression">Lambda expression</param> + /// <returns>criteria instance</returns> + IQueryOver<T> Where(Expression<Func<T, bool>> expression); + + /// <summary> + /// Identical semantics to Add() to allow more readable queries + /// </summary> + /// <param name="expression">Lambda expression</param> + /// <returns>criteria instance</returns> + IQueryOver<T> Where(Expression<Func<bool>> expression); + + /// <summary> + /// Creates a new NHibernate.ICriteria<T>, "rooted" at the associated entity + /// </summary> + /// <typeparam name="U">Type of sub-criteria</typeparam> + /// <param name="path">Lambda expression returning association path</param> + /// <returns>The created "sub criteria"</returns> + IQueryOver<U> JoinWalk<U>(Expression<Func<T, U>> path); + + /// <summary> + /// Creates a new NHibernate.ICriteria<T>, "rooted" at the associated entity + /// specifying a collection for the join. + /// </summary> + /// <typeparam name="U">Type of sub-criteria (type of the collection)</typeparam> + /// <param name="path">Lambda expression returning association path</param> + /// <returns>The created "sub criteria"</returns> + IQueryOver<U> JoinWalk<U>(Expression<Func<T, IEnumerable<U>>> path); + + /// <summary> + /// Join an association, assigning an alias to the joined entity + /// </summary> + /// <param name="path">Lambda expression returning association path</param> + /// <param name="alias">Lambda expression returning alias reference</param> + /// <returns>criteria instance</returns> + IQueryOver<T> Join(Expression<Func<T, object>> path, Expression<Func<object>> alias); + + /// <summary> + /// Get the results of the root type and fill the <see cref="IList<T>"/> + /// </summary> + /// <returns>The list filled with the results.</returns> + IList<T> List(); + + /// <summary> + /// Get an executable instance of <c>Criteria<T></c>, + /// to actually run the query.</summary> + IQueryOver<T> GetExecutableQueryOver(ISession session); + + } + +} Modified: trunk/nhibernate/src/NHibernate/ISession.cs =================================================================== --- trunk/nhibernate/src/NHibernate/ISession.cs 2009-07-02 04:24:50 UTC (rev 4560) +++ trunk/nhibernate/src/NHibernate/ISession.cs 2009-07-02 20:55:15 UTC (rev 4561) @@ -787,7 +787,7 @@ /// </summary> /// <typeparam name="T">The entity class</typeparam> /// <returns>An ICriteria<T> object</returns> - ICriteria<T> QueryOver<T>() where T : class; + IQueryOver<T> QueryOver<T>() where T : class; /// <summary> /// Create a new instance of <c>Query</c> for the given query string Modified: trunk/nhibernate/src/NHibernate/Impl/SessionImpl.cs =================================================================== --- trunk/nhibernate/src/NHibernate/Impl/SessionImpl.cs 2009-07-02 04:24:50 UTC (rev 4560) +++ trunk/nhibernate/src/NHibernate/Impl/SessionImpl.cs 2009-07-02 20:55:15 UTC (rev 4561) @@ -1872,7 +1872,7 @@ } } - public ICriteria<T> QueryOver<T>() where T : class + public IQueryOver<T> QueryOver<T>() where T : class { using (new SessionIdLoggingContext(SessionId)) { Modified: trunk/nhibernate/src/NHibernate/NHibernate.csproj =================================================================== --- trunk/nhibernate/src/NHibernate/NHibernate.csproj 2009-07-02 04:24:50 UTC (rev 4560) +++ trunk/nhibernate/src/NHibernate/NHibernate.csproj 2009-07-02 20:55:15 UTC (rev 4561) @@ -535,7 +535,7 @@ <Compile Include="Hql\Ast\ANTLR\Tree\ASTErrorNode.cs" /> <Compile Include="Hql\Ast\ANTLR\Tree\InsertStatement.cs" /> <Compile Include="Hql\Ast\ANTLR\Tree\UpdateStatement.cs" /> - <Compile Include="ICriteriaOfT.cs" /> + <Compile Include="IQueryOver.cs" /> <Compile Include="Criterion\QueryOver.cs" /> <Compile Include="Impl\ExpressionProcessor.cs" /> <Compile Include="Impl\SessionIdLoggingContext.cs" /> Deleted: trunk/nhibernate/src/NHibernate.Test/Criteria/Lambda/CriteriaOfTFixture.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/Criteria/Lambda/CriteriaOfTFixture.cs 2009-07-02 04:24:50 UTC (rev 4560) +++ trunk/nhibernate/src/NHibernate.Test/Criteria/Lambda/CriteriaOfTFixture.cs 2009-07-02 20:55:15 UTC (rev 4561) @@ -1,168 +0,0 @@ -using System; -using System.Collections; - -using NUnit.Framework; - -using NHibernate.Criterion; -using NHibernate.Transform; -using NHibernate.Type; -using NHibernate.Util; - -namespace NHibernate.Test.Criteria.Lambda -{ - - [TestFixture] - public class CriteriaOfTFixture : LambdaFixtureBase - { - - [Test] - public void SimpleCriterion_NoAlias() - { - ICriteria expected = - CreateTestCriteria(typeof(Person)) - .Add(Restrictions.Eq("Name", "test name")) - .Add(Restrictions.Not(Restrictions.Eq("Name", "not test name"))) - .Add(Restrictions.Gt("Age", 10)) - .Add(Restrictions.Ge("Age", 11)) - .Add(Restrictions.Lt("Age", 50)) - .Add(Restrictions.Le("Age", 49)); - - ICriteria<Person> actual = - CreateTestQueryOver<Person>() - .And(p => p.Name == "test name") - .And(p => p.Name != "not test name") - .And(p => p.Age > 10) - .And(p => p.Age >= 11) - .And(p => p.Age < 50) - .And(p => p.Age <= 49); - - AssertCriteriaAreEqual(expected, actual); - } - - [Test] - public void PropertyCriterion_NoAlias() - { - ICriteria expected = - CreateTestCriteria(typeof(Person)) - .Add(Restrictions.EqProperty("Age", "Height")) - .Add(Restrictions.NotEqProperty("Age", "Height")) - .Add(Restrictions.GtProperty("Age", "Height")) - .Add(Restrictions.GeProperty("Age", "Height")) - .Add(Restrictions.LtProperty("Age", "Height")) - .Add(Restrictions.LeProperty("Age", "Height")); - - ICriteria<Person> actual = - CreateTestQueryOver<Person>() - .And(p => p.Age == p.Height) - .And(p => p.Age != p.Height) - .And(p => p.Age > p.Height) - .And(p => p.Age >= p.Height) - .And(p => p.Age < p.Height) - .And(p => p.Age <= p.Height); - - AssertCriteriaAreEqual(expected, actual); - } - - [Test] - public void MultipleCriterionExpression() - { - ICriteria expected = - CreateTestCriteria(typeof(Person)) - .Add(Restrictions.And( - Restrictions.Eq("Name", "test name"), - Restrictions.Or( - Restrictions.Gt("Age", 21), - Restrictions.Eq("HasCar", true)))); - - ICriteria<Person> actual = - CreateTestQueryOver<Person>() - .Where(p => p.Name == "test name" && (p.Age > 21 || p.HasCar)); - - AssertCriteriaAreEqual(expected, actual); - } - - [Test] - public void Where_BehavesTheSameAs_And() - { - Person personAlias = null; - QueryOver<Person> expected = (QueryOver<Person>) - CreateTestQueryOver<Person>(() => personAlias) - .And(() => personAlias.Name == "test name") - .And(p => p.Name == "test name"); - - ICriteria<Person> actual = - CreateTestQueryOver<Person>(() => personAlias) - .Where(() => personAlias.Name == "test name") - .Where(p => p.Name == "test name"); - - AssertCriteriaAreEqual(expected.UnderlyingCriteria, actual); - } - - [Test] - public void SimpleCriterion_AliasReferenceSyntax() - { - ICriteria expected = - CreateTestCriteria(typeof(Person), "personAlias") - .Add(Restrictions.Eq("personAlias.Name", "test name")); - - Person personAlias = null; - ICriteria<Person> actual = - CreateTestQueryOver<Person>(() => personAlias) - .Where(() => personAlias.Name == "test name"); - - AssertCriteriaAreEqual(expected, actual); - } - - [Test] - public void SubCriteria_JoinWalk_ToOne() - { - ICriteria expected = - CreateTestCriteria(typeof(Person)) - .CreateCriteria("Father") - .Add(Expression.Eq("Name", "test name")); - - ICriteria<Person> actual = - CreateTestQueryOver<Person>() - .JoinWalk(p => p.Father) // sub-criteria - .Where(f => f.Name == "test name"); - - AssertCriteriaAreEqual(expected, actual); - } - - [Test] - public void SubCriteria_JoinWalk_ToMany() - { - ICriteria expected = - CreateTestCriteria(typeof(Person)) - .CreateCriteria("Children") - .Add(Expression.Eq("Nickname", "test name")); - - ICriteria<Child> actual = - CreateTestQueryOver<Person>() - .JoinWalk<Child>(p => p.Children) // sub-criteria - .Where(c => c.Nickname == "test name"); - - AssertCriteriaAreEqual(expected, actual); - } - - [Test] - public void Alias_Join() - { - ICriteria expected = - CreateTestCriteria(typeof(Person)) - .CreateAlias("Father", "fatherAlias") - .CreateAlias("Children", "childAlias"); - - Person fatherAlias = null; - Child childAlias = null; - ICriteria<Person> actual = - CreateTestQueryOver<Person>() - .Join(p => p.Father, () => fatherAlias) - .Join(p => p.Children, () => childAlias); - - AssertCriteriaAreEqual(expected, actual); - } - - } - -} \ No newline at end of file Modified: trunk/nhibernate/src/NHibernate.Test/Criteria/Lambda/LambdaFixtureBase.cs =================================================================== --- trunk/nhibernate/src/NHibernate.Test/Criteria/Lambda/LambdaFixtureBase.cs 2009-07-02 04:24:50 UTC (rev 4560) +++ trunk/nhibernate/src/NHibernate.Test/Criteria/Lambda/LambdaFixtureBase.cs 2009-07-02 20:55:15 UTC (rev 4561) @@ -30,12 +30,12 @@ return new CriteriaImpl(persistentClass, alias, null); } - protected ICriteria<T> CreateTestQueryOver<T>() + protected IQueryOver<T> CreateTestQueryOver<T>() { return new QueryOver<T>(new CriteriaImpl(typeof(T), null)); } - protected ICriteria<T> CreateTestQueryOver<T>(Expression<Func<object>> alias) + protected IQueryOver<T> CreateTestQueryOver<T>(Expression<Func<object>> alias) { string aliasContainer = ExpressionProcessor.FindMemberExpression(alias.Body); return new QueryOver<T>(new CriteriaImpl(typeof(T), aliasContainer, null)); @@ -51,7 +51,7 @@ AssertObjectsAreEqual(expected, actual); } - protected void AssertCriteriaAreEqual<T>(ICriteria expected, ICriteria<T> actual) + protected void AssertCriteriaAreEqual<T>(ICriteria expected, IQueryOver<T> actual) { AssertObjectsAreEqual(expected, ((QueryOver<T>)actual).UnderlyingCriteria); } Copied: trunk/nhibernate/src/NHibernate.Test/Criteria/Lambda/QueryOverFixture.cs (from rev 4560, trunk/nhibernate/src/NHibernate.Test/Criteria/Lambda/CriteriaOfTFixture.cs) =================================================================== --- trunk/nhibernate/src/NHibernate.Test/Criteria/Lambda/QueryOverFixture.cs (rev 0) +++ trunk/nhibernate/src/NHibernate.Test/Criteria/Lambda/QueryOverFixture.cs 2009-07-02 20:55:15 UTC (rev 4561) @@ -0,0 +1,168 @@ +using System; +using System.Collections; + +using NUnit.Framework; + +using NHibernate.Criterion; +using NHibernate.Transform; +using NHibernate.Type; +using NHibernate.Util; + +namespace NHibernate.Test.Criteria.Lambda +{ + + [TestFixture] + public class QueryOverFixture : LambdaFixtureBase + { + + [Test] + public void SimpleCriterion_NoAlias() + { + ICriteria expected = + CreateTestCriteria(typeof(Person)) + .Add(Restrictions.Eq("Name", "test name")) + .Add(Restrictions.Not(Restrictions.Eq("Name", "not test name"))) + .Add(Restrictions.Gt("Age", 10)) + .Add(Restrictions.Ge("Age", 11)) + .Add(Restrictions.Lt("Age", 50)) + .Add(Restrictions.Le("Age", 49)); + + IQueryOver<Person> actual = + CreateTestQueryOver<Person>() + .And(p => p.Name == "test name") + .And(p => p.Name != "not test name") + .And(p => p.Age > 10) + .And(p => p.Age >= 11) + .And(p => p.Age < 50) + .And(p => p.Age <= 49); + + AssertCriteriaAreEqual(expected, actual); + } + + [Test] + public void PropertyCriterion_NoAlias() + { + ICriteria expected = + CreateTestCriteria(typeof(Person)) + .Add(Restrictions.EqProperty("Age", "Height")) + .Add(Restrictions.NotEqProperty("Age", "Height")) + .Add(Restrictions.GtProperty("Age", "Height")) + .Add(Restrictions.GeProperty("Age", "Height")) + .Add(Restrictions.LtProperty("Age", "Height")) + .Add(Restrictions.LeProperty("Age", "Height")); + + IQueryOver<Person> actual = + CreateTestQueryOver<Person>() + .And(p => p.Age == p.Height) + .And(p => p.Age != p.Height) + .And(p => p.Age > p.Height) + .And(p => p.Age >= p.Height) + .And(p => p.Age < p.Height) + .And(p => p.Age <= p.Height); + + AssertCriteriaAreEqual(expected, actual); + } + + [Test] + public void MultipleCriterionExpression() + { + ICriteria expected = + CreateTestCriteria(typeof(Person)) + .Add(Restrictions.And( + Restrictions.Eq("Name", "test name"), + Restrictions.Or( + Restrictions.Gt("Age", 21), + Restrictions.Eq("HasCar", true)))); + + IQueryOver<Person> actual = + CreateTestQueryOver<Person>() + .Where(p => p.Name == "test name" && (p.Age > 21 || p.HasCar)); + + AssertCriteriaAreEqual(expected, actual); + } + + [Test] + public void Where_BehavesTheSameAs_And() + { + Person personAlias = null; + QueryOver<Person> expected = (QueryOver<Person>) + CreateTestQueryOver<Person>(() => personAlias) + .And(() => personAlias.Name == "test name") + .And(p => p.Name == "test name"); + + IQueryOver<Person> actual = + CreateTestQueryOver<Person>(() => personAlias) + .Where(() => personAlias.Name == "test name") + .Where(p => p.Name == "test name"); + + AssertCriteriaAreEqual(expected.UnderlyingCriteria, actual); + } + + [Test] + public void SimpleCriterion_AliasReferenceSyntax() + { + ICriteria expected = + CreateTestCriteria(typeof(Person), "personAlias") + .Add(Restrictions.Eq("personAlias.Name", "test name")); + + Person personAlias = null; + IQueryOver<Person> actual = + CreateTestQueryOver<Person>(() => personAlias) + .Where(() => personAlias.Name == "test name"); + + AssertCriteriaAreEqual(expected, actual); + } + + [Test] + public void SubCriteria_JoinWalk_ToOne() + { + ICriteria expected = + CreateTestCriteria(typeof(Person)) + .CreateCriteria("Father") + .Add(Expression.Eq("Name", "test name")); + + IQueryOver<Person> actual = + CreateTestQueryOver<Person>() + .JoinWalk(p => p.Father) // sub-criteria + .Where(f => f.Name == "test name"); + + AssertCriteriaAreEqual(expected, actual); + } + + [Test] + public void SubCriteria_JoinWalk_ToMany() + { + ICriteria expected = + CreateTestCriteria(typeof(Person)) + .CreateCriteria("Children") + .Add(Expression.Eq("Nickname", "test name")); + + IQueryOver<Child> actual = + CreateTestQueryOver<Person>() + .JoinWalk<Child>(p => p.Children) // sub-criteria + .Where(c => c.Nickname == "test name"); + + AssertCriteriaAreEqual(expected, actual); + } + + [Test] + public void Alias_Join() + { + ICriteria expected = + CreateTestCriteria(typeof(Person)) + .CreateAlias("Father", "fatherAlias") + .CreateAlias("Children", "childAlias"); + + Person fatherAlias = null; + Child childAlias = null; + IQueryOver<Person> actual = + CreateTestQueryOver<Person>() + .Join(p => p.Father, () => fatherAlias) + .Join(p => p.Children, () => childAlias); + + AssertCriteriaAreEqual(expected, actual); + } + + } + +} \ No newline at end of file Modified: trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj =================================================================== --- trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2009-07-02 04:24:50 UTC (rev 4560) +++ trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2009-07-02 20:55:15 UTC (rev 4561) @@ -147,7 +147,7 @@ <Compile Include="Criteria\DetachedCriteriaSerializable.cs" /> <Compile Include="Criteria\Enrolment.cs" /> <Compile Include="Criteria\Lambda\CriteriaAssertFixture.cs" /> - <Compile Include="Criteria\Lambda\CriteriaOfTFixture.cs" /> + <Compile Include="Criteria\Lambda\QueryOverFixture.cs" /> <Compile Include="Criteria\Lambda\IntegrationFixture.cs" /> <Compile Include="Criteria\Lambda\LambdaFixtureBase.cs" /> <Compile Include="Criteria\Lambda\Model.cs" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |