@@ -17,6 +17,7 @@ public class EntityProjection : IProjection
1717 private string _entityAlias ;
1818 private System . Type _rootEntity ;
1919 private IType [ ] _types ;
20+ private string [ ] _identifierColumnAliases ;
2021
2122 /// <summary>
2223 /// Root entity projection
@@ -46,20 +47,15 @@ public EntityProjection(System.Type rootEntity, string entityAlias)
4647 /// </summary>
4748 public bool Lazy { get ; set ; }
4849
49- internal string [ ] IdentifierColumnAliases { get ; set ; }
5050 internal IQueryable Persister { get ; private set ; }
51-
52-
53- public string ColumnAliasSuffix { get ; private set ; }
54- public string TableAlias { get ; private set ; }
51+ internal string ColumnAliasSuffix { get ; private set ; }
52+ internal string TableAlias { get ; private set ; }
5553
5654 #region Configuration methods
5755
5856 /// <summary>
5957 /// Lazy load entity
6058 /// </summary>
61- /// <param name="lazy"></param>
62- /// <returns></returns>
6359 public EntityProjection SetLazy ( bool lazy = true )
6460 {
6561 Lazy = lazy ;
@@ -69,8 +65,6 @@ public EntityProjection SetLazy(bool lazy = true)
6965 /// <summary>
7066 /// Fetch lazy properties
7167 /// </summary>
72- /// <param name="fetchLazyProperties"></param>
73- /// <returns></returns>
7468 public EntityProjection SetFetchLazyProperties ( bool fetchLazyProperties = true )
7569 {
7670 FetchLazyProperties = fetchLazyProperties ;
@@ -81,27 +75,15 @@ public EntityProjection SetFetchLazyProperties(bool fetchLazyProperties = true)
8175
8276 #region IProjection implementation
8377
84- /// <summary>
85- /// Entity alias
86- /// </summary>
87- public string [ ] Aliases
88- {
89- get { return new [ ] { _entityAlias } ; }
90- }
78+ string [ ] IProjection . Aliases => new [ ] { _entityAlias } ;
9179
92- bool IProjection . IsAggregate
93- {
94- get { return false ; }
95- }
80+ bool IProjection . IsAggregate => false ;
9681
97- bool IProjection . IsGrouped
98- {
99- get { return false ; }
100- }
82+ bool IProjection . IsGrouped => false ;
10183
10284 IType [ ] IProjection . GetTypes ( string alias , ICriteria criteria , ICriteriaQuery criteriaQuery )
10385 {
104- return new [ ] { criteriaQuery . GetType ( criteria , alias ) } ;
86+ return new [ ] { criteriaQuery . GetType ( criteria , alias ) } ;
10587 }
10688
10789 IType [ ] IProjection . GetTypes ( ICriteria criteria , ICriteriaQuery criteriaQuery )
@@ -115,19 +97,18 @@ string[] IProjection.GetColumnAliases(int position, ICriteria criteria, ICriteri
11597 {
11698 SetFields ( criteria , criteriaQuery ) ;
11799
118- return IdentifierColumnAliases ;
100+ return _identifierColumnAliases ;
119101 }
120102
121103 string [ ] IProjection . GetColumnAliases ( string alias , int position , ICriteria criteria , ICriteriaQuery criteriaQuery )
122104 {
123105 SetFields ( criteria , criteriaQuery ) ;
124106
125- return IdentifierColumnAliases ;
107+ return _identifierColumnAliases ;
126108 }
127109
128110 SqlString IProjection . ToSqlString ( ICriteria criteria , int position , ICriteriaQuery criteriaQuery )
129111 {
130- //return new SqlString(string.Empty);
131112 SetFields ( criteria , criteriaQuery ) ;
132113
133114 string identifierSelectFragment = Persister . IdentifierSelectFragment ( TableAlias , ColumnAliasSuffix ) ;
@@ -141,12 +122,12 @@ SqlString IProjection.ToSqlString(ICriteria criteria, int position, ICriteriaQue
141122
142123 SqlString IProjection . ToGroupSqlString ( ICriteria criteria , ICriteriaQuery criteriaQuery )
143124 {
144- throw new NotImplementedException ( ) ;
125+ throw new InvalidOperationException ( "not a grouping projection" ) ;
145126 }
146127
147128 TypedValue [ ] IProjection . GetTypedValues ( ICriteria criteria , ICriteriaQuery criteriaQuery )
148129 {
149- throw new NotImplementedException ( ) ;
130+ return Array . Empty < TypedValue > ( ) ;
150131 }
151132
152133 #endregion IProjection implementation
@@ -192,9 +173,9 @@ private void SetFields(ICriteria criteria, ICriteriaQuery criteriaQuery)
192173
193174 ColumnAliasSuffix = BasicLoader . GenerateSuffix ( criteriaQuery . GetIndexForAlias ( ) ) ;
194175
195- IdentifierColumnAliases = Persister . GetIdentifierAliases ( ColumnAliasSuffix ) ;
176+ _identifierColumnAliases = Persister . GetIdentifierAliases ( ColumnAliasSuffix ) ;
196177
197- _types = new IType [ ] { TypeFactory . ManyToOne ( Persister . EntityName , true ) , } ;
178+ _types = new IType [ ] { TypeFactory . ManyToOne ( Persister . EntityName , true ) , } ;
198179 }
199180 }
200181}
0 commit comments