|
From: <ric...@us...> - 2009-07-27 10:49:27
|
Revision: 4662
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4662&view=rev
Author: ricbrown
Date: 2009-07-27 10:49:18 +0000 (Mon, 27 Jul 2009)
Log Message:
-----------
Corrected syntax for IQueryOver.Select(...)
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/Criterion/QueryOver.cs
trunk/nhibernate/src/NHibernate/IQueryOver.cs
trunk/nhibernate/src/NHibernate.Test/Criteria/Lambda/QueryOverFixture.cs
Modified: trunk/nhibernate/src/NHibernate/Criterion/QueryOver.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Criterion/QueryOver.cs 2009-07-27 09:42:13 UTC (rev 4661)
+++ trunk/nhibernate/src/NHibernate/Criterion/QueryOver.cs 2009-07-27 10:49:18 UTC (rev 4662)
@@ -62,19 +62,14 @@
return Add(expression);
}
- public QueryOver<T> Select(Expression<Func<object>>[] projections)
+ public QueryOver<T> Select(params Expression<Func<T, object>>[] projections)
{
- foreach (var projection in projections)
- Select(projection);
+ List<IProjection> projectionList = new List<IProjection>();
- return this;
- }
-
- public QueryOver<T> Select(Expression<Func<T, object>>[] projections)
- {
foreach (var projection in projections)
- Select(projection);
+ projectionList.Add(Projections.Property(ExpressionProcessor.FindMemberExpression(projection.Body)));
+ _criteria.SetProjection(projectionList.ToArray());
return this;
}
@@ -230,16 +225,6 @@
return this;
}
- private void Select(Expression<Func<T, object>> projection)
- {
- _criteria.SetProjection(Projections.Property(ExpressionProcessor.FindMemberExpression(projection.Body)));
- }
-
- private void Select(Expression<Func<object>> projection)
- {
- _criteria.SetProjection(Projections.Property(ExpressionProcessor.FindMemberExpression(projection.Body)));
- }
-
private QueryOver<T> AddOrder(Expression<Func<T, object>> path, Func<string, Order> orderDelegate)
{
_criteria.AddOrder(ExpressionProcessor.ProcessOrder<T>(path, orderDelegate));
@@ -268,9 +253,6 @@
IQueryOver<T> IQueryOver<T>.Select(params Expression<Func<T, object>>[] projections)
{ return Select(projections); }
- IQueryOver<T> IQueryOver<T>.Select(params Expression<Func<object>>[] projections)
- { return Select(projections); }
-
IQueryOver<T> IQueryOver<T>.OrderBy(Expression<Func<T, object>> path, Func<string, Order> orderDelegate)
{ return OrderBy(path, orderDelegate); }
Modified: trunk/nhibernate/src/NHibernate/IQueryOver.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/IQueryOver.cs 2009-07-27 09:42:13 UTC (rev 4661)
+++ trunk/nhibernate/src/NHibernate/IQueryOver.cs 2009-07-27 10:49:18 UTC (rev 4662)
@@ -60,13 +60,6 @@
IQueryOver<T> Select(params Expression<Func<T, object>>[] projections);
/// <summary>
- /// Add projection expressed as a lambda expression
- /// </summary>
- /// <param name="projections">Lambda expressions</param>
- /// <returns>criteria instance</returns>
- IQueryOver<T> Select(params Expression<Func<object>>[] projections);
-
- /// <summary>
/// Add order expressed as a lambda expression
/// </summary>
/// <param name="path">Lambda expression</param>
Modified: trunk/nhibernate/src/NHibernate.Test/Criteria/Lambda/QueryOverFixture.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/Criteria/Lambda/QueryOverFixture.cs 2009-07-27 09:42:13 UTC (rev 4661)
+++ trunk/nhibernate/src/NHibernate.Test/Criteria/Lambda/QueryOverFixture.cs 2009-07-27 10:49:18 UTC (rev 4662)
@@ -264,18 +264,19 @@
{
ICriteria expected =
CreateTestCriteria(typeof(Person), "personAlias")
- .SetProjection(Projections.Property("Name"))
- .SetProjection(Projections.Property("Age"))
- .SetProjection(Projections.Property("personAlias.Gender"))
- .SetProjection(Projections.Property("personAlias.HasCar"));
+ .SetProjection(
+ Projections.Property("Name"),
+ Projections.Property("Age"),
+ Projections.Property("personAlias.Gender"),
+ Projections.Property("personAlias.HasCar"));
Person personAlias = null;
IQueryOver<Person> actual =
CreateTestQueryOver<Person>(() => personAlias)
.Select(p => p.Name,
- p => p.Age)
- .Select(() => personAlias.Gender,
- () => personAlias.HasCar);
+ p => p.Age,
+ p => personAlias.Gender,
+ p => personAlias.HasCar);
AssertCriteriaAreEqual(expected, actual);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|