Skip to content

Commit 0fa5e02

Browse files
committed
NH-3644: Move methods from IEnhancedProjection into IProjection.
1 parent fb9c0aa commit 0fa5e02

File tree

5 files changed

+57
-27
lines changed

5 files changed

+57
-27
lines changed

releasenotes.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
Build 4.0.0.XXXX
2+
=============================
3+
4+
** Known BREAKING CHANGES from NH4.0.0.Alpha2 to 4.0.0.Alpha1
5+
6+
The interface IEnhancedProjection was removed and its methods moved to IProjection.
7+
18
Build 4.0.0.Alpha2
29
=============================
310

src/NHibernate/Criterion/GroupedProjection.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,18 @@ public virtual string[] GetColumnAliases(string alias, int loc)
4848
return null;
4949
}
5050

51+
public string[] GetColumnAliases(int position, ICriteria criteria, ICriteriaQuery criteriaQuery)
52+
{
53+
return projection is IEnhancedProjection
54+
? ((IEnhancedProjection)projection).GetColumnAliases(position, criteria, criteriaQuery)
55+
: this.GetColumnAliases(position);
56+
}
57+
58+
public string[] GetColumnAliases(string alias, int position, ICriteria criteria, ICriteriaQuery criteriaQuery)
59+
{
60+
return null;
61+
}
62+
5163
public virtual string[] Aliases
5264
{
5365
get { return new string[] { }; }

src/NHibernate/Criterion/IEnhancedProjection.cs

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,5 @@ namespace NHibernate.Criterion
77
/// </summary>
88
public interface IEnhancedProjection : IProjection
99
{
10-
/// <summary>
11-
/// Get the SQL column aliases used by this projection for the columns it writes for inclusion into the
12-
/// <code>SELECT</code> clause <see cref="IProjection.ToSqlString" />. NHibernate always uses column aliases
13-
/// to extract data from the <see cref="System.Data.IDataReader" />, so it is important that these be implemented
14-
/// correctly in order for NHibernate to be able to extract these values correctly.
15-
/// </summary>
16-
/// <param name="position">Just as in <see cref="IProjection.ToSqlString" />, represents the number of columns rendered prior to this projection.</param>
17-
/// <param name="criteria">The local criteria to which this project is attached (for resolution).</param>
18-
/// <param name="criteriaQuery">The overall criteria query instance.</param>
19-
/// <returns>The columns aliases.</returns>
20-
string[] GetColumnAliases(int position, ICriteria criteria, ICriteriaQuery criteriaQuery);
21-
22-
/// <summary>
23-
/// Get the SQL column aliases used by this projection for the columns it writes for inclusion into the
24-
/// <code>SELECT</code> clause (<see cref="IProjection.ToSqlString" />) for a particular criteria-level alias.
25-
/// </summary>
26-
/// <param name="alias">The criteria-level alias.</param>
27-
/// <param name="position">Just as in <see cref="IProjection.ToSqlString" />, represents the number of columns rendered prior to this projection.</param>
28-
/// <param name="criteria">The local criteria to which this project is attached (for resolution).</param>
29-
/// <param name="criteriaQuery">The overall criteria query instance.</param>
30-
/// <returns>The columns aliases.</returns>
31-
string[] GetColumnAliases(string alias, int position, ICriteria criteria, ICriteriaQuery criteriaQuery);
3210
}
3311
}

src/NHibernate/Criterion/IProjection.cs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,5 +86,28 @@ SqlString ToGroupSqlString(ICriteria criteria,
8686
/// <param name="criteriaQuery">The criteria query.</param>
8787
/// <returns></returns>
8888
TypedValue[] GetTypedValues(ICriteria criteria, ICriteriaQuery criteriaQuery);
89+
90+
/// <summary>
91+
/// Get the SQL column aliases used by this projection for the columns it writes for inclusion into the
92+
/// <code>SELECT</code> clause <see cref="IProjection.ToSqlString" />. NHibernate always uses column aliases
93+
/// to extract data from the <see cref="System.Data.IDataReader" />, so it is important that these be implemented
94+
/// correctly in order for NHibernate to be able to extract these values correctly.
95+
/// </summary>
96+
/// <param name="position">Just as in <see cref="IProjection.ToSqlString" />, represents the number of columns rendered prior to this projection.</param>
97+
/// <param name="criteria">The local criteria to which this project is attached (for resolution).</param>
98+
/// <param name="criteriaQuery">The overall criteria query instance.</param>
99+
/// <returns>The columns aliases.</returns>
100+
string[] GetColumnAliases(int position, ICriteria criteria, ICriteriaQuery criteriaQuery);
101+
102+
/// <summary>
103+
/// Get the SQL column aliases used by this projection for the columns it writes for inclusion into the
104+
/// <code>SELECT</code> clause (<see cref="IProjection.ToSqlString" />) for a particular criteria-level alias.
105+
/// </summary>
106+
/// <param name="alias">The criteria-level alias.</param>
107+
/// <param name="position">Just as in <see cref="IProjection.ToSqlString" />, represents the number of columns rendered prior to this projection.</param>
108+
/// <param name="criteria">The local criteria to which this project is attached (for resolution).</param>
109+
/// <param name="criteriaQuery">The overall criteria query instance.</param>
110+
/// <returns>The columns aliases.</returns>
111+
string[] GetColumnAliases(string alias, int position, ICriteria criteria, ICriteriaQuery criteriaQuery);
89112
}
90113
}

src/NHibernate/Criterion/SQLProjection.cs

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,6 @@ public string[] Aliases
6464
get { return aliases; }
6565
}
6666

67-
public string[] GetColumnAliases(int loc)
68-
{
69-
return columnAliases;
70-
}
71-
7267
public bool IsGrouped
7368
{
7469
get { return grouped; }
@@ -95,9 +90,24 @@ public IType[] GetTypes(string alias, ICriteria crit, ICriteriaQuery criteriaQue
9590
return null; //unsupported
9691
}
9792

93+
public string[] GetColumnAliases(int loc)
94+
{
95+
return columnAliases;
96+
}
97+
9898
public string[] GetColumnAliases(String alias, int loc)
9999
{
100100
return null; //unsupported
101101
}
102+
103+
public string[] GetColumnAliases(int position, ICriteria criteria, ICriteriaQuery criteriaQuery)
104+
{
105+
return columnAliases;
106+
}
107+
108+
public string[] GetColumnAliases(string alias, int position, ICriteria criteria, ICriteriaQuery criteriaQuery)
109+
{
110+
return null; //unsupported
111+
}
102112
}
103113
}

0 commit comments

Comments
 (0)