Skip to content

Commit 71a4165

Browse files
committed
Cleaned up some custom SQL code
1 parent 69cd430 commit 71a4165

File tree

2 files changed

+6
-13
lines changed

2 files changed

+6
-13
lines changed

src/NHibernate/Loader/Custom/Sql/SQLCustomQuery.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public class SQLCustomQuery : ICustomQuery
2121
private readonly List<IReturn> customQueryReturns = new List<IReturn>();
2222
private readonly ISet<string> querySpaces = new HashedSet<string>();
2323
private readonly SqlString sql;
24-
private List<IParameterSpecification> parametersSpecifications;
24+
private readonly List<IParameterSpecification> parametersSpecifications;
2525

2626
public SQLCustomQuery(INativeSQLQueryReturn[] queryReturns, string sqlQuery, ICollection<string> additionalQuerySpaces,
2727
ISessionFactoryImplementor factory)

src/NHibernate/Loader/Custom/Sql/SQLQueryReturnProcessor.cs

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -103,14 +103,7 @@ public IDictionary<string, string[]> GetPropertyResultsMap(string alias)
103103
private IDictionary<string, string[]> InternalGetPropertyResultsMap(string alias)
104104
{
105105
NativeSQLQueryNonScalarReturn rtn = alias2Return[alias] as NativeSQLQueryNonScalarReturn;
106-
if (rtn != null)
107-
{
108-
return rtn.PropertyResultsMap;
109-
}
110-
else
111-
{
112-
return null;
113-
}
106+
return rtn != null ? rtn.PropertyResultsMap : null;
114107
}
115108

116109
private bool HasPropertyResultMap(string alias)
@@ -125,13 +118,13 @@ public ResultAliasContext Process()
125118
// so that role returns can be more easily resolved to their owners
126119
for (int i = 0; i < queryReturns.Length; i++)
127120
{
128-
if (queryReturns[i] is NativeSQLQueryNonScalarReturn)
121+
var rtn = queryReturns[i] as NativeSQLQueryNonScalarReturn;
122+
if (rtn != null)
129123
{
130-
NativeSQLQueryNonScalarReturn rtn = (NativeSQLQueryNonScalarReturn) queryReturns[i];
131124
alias2Return[rtn.Alias] = rtn;
132-
if (rtn is NativeSQLQueryJoinReturn)
125+
var roleReturn = queryReturns[i] as NativeSQLQueryJoinReturn;
126+
if (roleReturn != null)
133127
{
134-
NativeSQLQueryJoinReturn roleReturn = (NativeSQLQueryJoinReturn) queryReturns[i];
135128
alias2OwnerAlias[roleReturn.Alias] = roleReturn.OwnerAlias;
136129
}
137130
}

0 commit comments

Comments
 (0)