@@ -17,6 +17,7 @@ public class EntityProjection : IProjection
17
17
private string _entityAlias ;
18
18
private System . Type _rootEntity ;
19
19
private IType [ ] _types ;
20
+ private string [ ] _identifierColumnAliases ;
20
21
21
22
/// <summary>
22
23
/// Root entity projection
@@ -46,20 +47,15 @@ public EntityProjection(System.Type rootEntity, string entityAlias)
46
47
/// </summary>
47
48
public bool Lazy { get ; set ; }
48
49
49
- internal string [ ] IdentifierColumnAliases { get ; set ; }
50
50
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 ; }
55
53
56
54
#region Configuration methods
57
55
58
56
/// <summary>
59
57
/// Lazy load entity
60
58
/// </summary>
61
- /// <param name="lazy"></param>
62
- /// <returns></returns>
63
59
public EntityProjection SetLazy ( bool lazy = true )
64
60
{
65
61
Lazy = lazy ;
@@ -69,8 +65,6 @@ public EntityProjection SetLazy(bool lazy = true)
69
65
/// <summary>
70
66
/// Fetch lazy properties
71
67
/// </summary>
72
- /// <param name="fetchLazyProperties"></param>
73
- /// <returns></returns>
74
68
public EntityProjection SetFetchLazyProperties ( bool fetchLazyProperties = true )
75
69
{
76
70
FetchLazyProperties = fetchLazyProperties ;
@@ -81,27 +75,15 @@ public EntityProjection SetFetchLazyProperties(bool fetchLazyProperties = true)
81
75
82
76
#region IProjection implementation
83
77
84
- /// <summary>
85
- /// Entity alias
86
- /// </summary>
87
- public string [ ] Aliases
88
- {
89
- get { return new [ ] { _entityAlias } ; }
90
- }
78
+ string [ ] IProjection . Aliases => new [ ] { _entityAlias } ;
91
79
92
- bool IProjection . IsAggregate
93
- {
94
- get { return false ; }
95
- }
80
+ bool IProjection . IsAggregate => false ;
96
81
97
- bool IProjection . IsGrouped
98
- {
99
- get { return false ; }
100
- }
82
+ bool IProjection . IsGrouped => false ;
101
83
102
84
IType [ ] IProjection . GetTypes ( string alias , ICriteria criteria , ICriteriaQuery criteriaQuery )
103
85
{
104
- return new [ ] { criteriaQuery . GetType ( criteria , alias ) } ;
86
+ return new [ ] { criteriaQuery . GetType ( criteria , alias ) } ;
105
87
}
106
88
107
89
IType [ ] IProjection . GetTypes ( ICriteria criteria , ICriteriaQuery criteriaQuery )
@@ -115,19 +97,18 @@ string[] IProjection.GetColumnAliases(int position, ICriteria criteria, ICriteri
115
97
{
116
98
SetFields ( criteria , criteriaQuery ) ;
117
99
118
- return IdentifierColumnAliases ;
100
+ return _identifierColumnAliases ;
119
101
}
120
102
121
103
string [ ] IProjection . GetColumnAliases ( string alias , int position , ICriteria criteria , ICriteriaQuery criteriaQuery )
122
104
{
123
105
SetFields ( criteria , criteriaQuery ) ;
124
106
125
- return IdentifierColumnAliases ;
107
+ return _identifierColumnAliases ;
126
108
}
127
109
128
110
SqlString IProjection . ToSqlString ( ICriteria criteria , int position , ICriteriaQuery criteriaQuery )
129
111
{
130
- //return new SqlString(string.Empty);
131
112
SetFields ( criteria , criteriaQuery ) ;
132
113
133
114
string identifierSelectFragment = Persister . IdentifierSelectFragment ( TableAlias , ColumnAliasSuffix ) ;
@@ -141,12 +122,12 @@ SqlString IProjection.ToSqlString(ICriteria criteria, int position, ICriteriaQue
141
122
142
123
SqlString IProjection . ToGroupSqlString ( ICriteria criteria , ICriteriaQuery criteriaQuery )
143
124
{
144
- throw new NotImplementedException ( ) ;
125
+ throw new InvalidOperationException ( "not a grouping projection" ) ;
145
126
}
146
127
147
128
TypedValue [ ] IProjection . GetTypedValues ( ICriteria criteria , ICriteriaQuery criteriaQuery )
148
129
{
149
- throw new NotImplementedException ( ) ;
130
+ return Array . Empty < TypedValue > ( ) ;
150
131
}
151
132
152
133
#endregion IProjection implementation
@@ -192,9 +173,9 @@ private void SetFields(ICriteria criteria, ICriteriaQuery criteriaQuery)
192
173
193
174
ColumnAliasSuffix = BasicLoader . GenerateSuffix ( criteriaQuery . GetIndexForAlias ( ) ) ;
194
175
195
- IdentifierColumnAliases = Persister . GetIdentifierAliases ( ColumnAliasSuffix ) ;
176
+ _identifierColumnAliases = Persister . GetIdentifierAliases ( ColumnAliasSuffix ) ;
196
177
197
- _types = new IType [ ] { TypeFactory . ManyToOne ( Persister . EntityName , true ) , } ;
178
+ _types = new IType [ ] { TypeFactory . ManyToOne ( Persister . EntityName , true ) , } ;
198
179
}
199
180
}
200
181
}
0 commit comments