Skip to content

Commit 9ece50d

Browse files
committed
small code refactoring
1 parent 36e8ff2 commit 9ece50d

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

src/NHibernate/Criterion/EntityProjection.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ namespace NHibernate.Criterion
1515
public class EntityProjection : IProjection
1616
{
1717
private string _entityAlias;
18-
private System.Type _rootEntity;
18+
private System.Type _entityType;
1919
private IType[] _types;
2020
private string[] _identifierColumnAliases;
2121

@@ -29,11 +29,11 @@ public EntityProjection() : this(null, null)
2929
/// <summary>
3030
/// Entity projection for given type and alias
3131
/// </summary>
32-
/// <param name="rootEntity">Type of entity</param>
32+
/// <param name="entityType">Type of entity</param>
3333
/// <param name="entityAlias">Entity alias</param>
34-
public EntityProjection(System.Type rootEntity, string entityAlias)
34+
public EntityProjection(System.Type entityType, string entityAlias)
3535
{
36-
_rootEntity = rootEntity;
36+
_entityType = entityType;
3737
_entityAlias = entityAlias;
3838
}
3939

@@ -148,19 +148,19 @@ private void SetFields(ICriteriaQuery criteriaQuery)
148148
entityProjectionQuery.RegisterEntityProjection(this);
149149
}
150150

151-
if (_rootEntity == null)
151+
if (_entityType == null)
152152
{
153-
_rootEntity = criteria.GetRootEntityTypeIfAvailable();
153+
_entityType = criteria.GetRootEntityTypeIfAvailable();
154154
}
155155

156156
if (_entityAlias == null)
157157
{
158158
_entityAlias = criteria.Alias;
159159
}
160160

161-
Persister = criteriaQuery.Factory.GetEntityPersister(_rootEntity.FullName) as IQueryable;
161+
Persister = criteriaQuery.Factory.GetEntityPersister(_entityType.FullName) as IQueryable;
162162
if (Persister == null)
163-
throw new HibernateException($"Projecting to entities requires a '{typeof(IQueryable).FullName}' persister, '{_rootEntity.FullName}' does not have one.");
163+
throw new HibernateException($"Projecting to entities requires a '{typeof(IQueryable).FullName}' persister, '{_entityType.FullName}' does not have one.");
164164

165165
ICriteria subcriteria = criteria.GetCriteriaByAlias(_entityAlias);
166166
if (subcriteria == null)

src/NHibernate/Criterion/Projections.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public static EntityProjection Entity<T>(string alias)
4848
}
4949

5050
/// <summary>
51-
/// Returns an aliased entity.
51+
/// Projection for entity with given alias.
5252
/// </summary>
5353
/// /// <typeparam name="T">The type of the entity.</typeparam>
5454
/// <param name="alias">The alias of the entity.</param>

src/NHibernate/Criterion/ProjectionsExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ internal static IProjection ProcessAsEntity(MethodCallExpression methodCallExpre
347347
{
348348
var expression = methodCallExpression.Arguments[0];
349349
var aliasName = ExpressionProcessor.FindMemberExpression(expression);
350-
return new EntityProjection(expression.Type, aliasName);
350+
return Projections.Entity(expression.Type, aliasName);
351351
}
352352
}
353353
}

0 commit comments

Comments
 (0)