Skip to content

Commit 7e32107

Browse files
committed
XmlHbmBinding/ResultSetMappingBinder.cs: Comment out a piece of code that I believe would always cause exception, to get rid of call to ArrayHelper.AddAll() (preparing to add an overload that would be ambiguous).
Criterion/Junction.cs, Criterion/ProjectionList.cs: Remove needless use of ArrayHelper.AddAll().
1 parent 2bce8b9 commit 7e32107

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

src/NHibernate/Cfg/XmlHbmBinding/ResultSetMappingBinder.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,15 @@ private IDictionary<string, string[]> BindPropertyResults(string alias, HbmRetur
292292
if (!propertyresults.TryGetValue(key,out intermediateResults))
293293
propertyresults[key] = allResultColumns.ToArray();
294294
else
295-
ArrayHelper.AddAll(intermediateResults, allResultColumns); // TODO: intermediateResults not used after this
295+
{
296+
throw new NotImplementedException();
297+
// 2013-02-24: In 89994bc113e1bb35bf6bcd0b7408d08340bfbccd, 2008-05-29, the intermediateResults
298+
// variable was changed from ArrayList to string[]. The following code line was there before.
299+
// Since an array cannot be modified, it seems this code line has never been hit since then.
300+
// While working on NH-3345, I'm adding an ambigous overload for AddAll(), and I don't want to
301+
// try to understand this code right now, so comment it out instead. /Oskar
302+
//ArrayHelper.AddAll(intermediateResults, allResultColumns); // TODO: intermediateResults not used after this
303+
}
296304
}
297305

298306
Dictionary<string, string[]> newPropertyResults = new Dictionary<string, string[]>();

src/NHibernate/Criterion/Junction.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public override TypedValue[] GetTypedValues(ICriteria criteria, ICriteriaQuery c
6666
foreach (ICriterion criterion in this.criteria)
6767
{
6868
TypedValue[] subvalues = criterion.GetTypedValues(criteria, criteriaQuery);
69-
ArrayHelper.AddAll(typedValues, subvalues);
69+
typedValues.AddRange(subvalues);
7070
}
7171

7272
return typedValues.ToArray();

src/NHibernate/Criterion/ProjectionList.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,11 +120,11 @@ public string[] GetColumnAliases(string alias, int loc)
120120

121121
public string[] GetColumnAliases(int position, ICriteria criteria, ICriteriaQuery criteriaQuery)
122122
{
123-
var result = new List<object>(Length);
123+
var result = new List<string>(Length);
124124
for (var i = 0; i < Length; i++)
125125
{
126126
var colAliases = GetColumnAliases(position, criteria, criteriaQuery, this[i]);
127-
ArrayHelper.AddAll(result, colAliases);
127+
result.AddRange(colAliases);
128128
position += colAliases.Length;
129129
}
130130
return ArrayHelper.ToStringArray(result);

0 commit comments

Comments
 (0)