@@ -184,6 +184,15 @@ public virtual SqlExpression<T> Select(string[] fields)
184184 return this ;
185185 }
186186
187+ private SqlExpression < T > InternalSelect ( Expression fields , bool distinct = false )
188+ {
189+ sep = string . Empty ;
190+ useFieldName = true ;
191+ CustomSelect = true ;
192+ BuildSelectExpression ( Visit ( fields ) . ToString ( ) , distinct : distinct ) ;
193+ return this ;
194+ }
195+
187196 /// <summary>
188197 /// Fields to be selected.
189198 /// </summary>
@@ -193,74 +202,77 @@ public virtual SqlExpression<T> Select(string[] fields)
193202 /// </typeparam>
194203 public virtual SqlExpression < T > Select ( Expression < Func < T , object > > fields )
195204 {
196- sep = string . Empty ;
197- useFieldName = true ;
198- CustomSelect = true ;
199- BuildSelectExpression ( Visit ( fields ) . ToString ( ) , false ) ;
200- return this ;
205+ return InternalSelect ( fields ) ;
201206 }
202207
203208 public virtual SqlExpression < T > Select < Table1 > ( Expression < Func < Table1 , object > > fields )
204209 {
205- sep = string . Empty ;
206- useFieldName = true ;
207- CustomSelect = true ;
208- BuildSelectExpression ( Visit ( fields ) . ToString ( ) , false ) ;
209- return this ;
210+ return InternalSelect ( fields ) ;
210211 }
211212
212213 public virtual SqlExpression < T > Select < Table1 , Table2 > ( Expression < Func < Table1 , Table2 , object > > fields )
213214 {
214- sep = string . Empty ;
215- useFieldName = true ;
216- CustomSelect = true ;
217- BuildSelectExpression ( Visit ( fields ) . ToString ( ) , false ) ;
218- return this ;
215+ return InternalSelect ( fields ) ;
219216 }
220217
221218 public virtual SqlExpression < T > Select < Table1 , Table2 , Table3 > ( Expression < Func < Table1 , Table2 , Table3 , object > > fields )
222219 {
223- sep = string . Empty ;
224- useFieldName = true ;
225- CustomSelect = true ;
226- BuildSelectExpression ( Visit ( fields ) . ToString ( ) , false ) ;
227- return this ;
220+ return InternalSelect ( fields ) ;
228221 }
229222
230223 public virtual SqlExpression < T > Select < Table1 , Table2 , Table3 , Table4 > ( Expression < Func < Table1 , Table2 , Table3 , Table4 , object > > fields )
231224 {
232- sep = string . Empty ;
233- useFieldName = true ;
234- CustomSelect = true ;
235- BuildSelectExpression ( Visit ( fields ) . ToString ( ) , false ) ;
236- return this ;
225+ return InternalSelect ( fields ) ;
237226 }
238227
239- public virtual SqlExpression < T > SelectDistinct < TKey > ( Expression < Func < T , TKey > > fields )
228+ public virtual SqlExpression < T > Select < Table1 , Table2 , Table3 , Table4 , Table5 > ( Expression < Func < Table1 , Table2 , Table3 , Table4 , Table5 , object > > fields )
240229 {
241- sep = string . Empty ;
242- useFieldName = true ;
243- CustomSelect = true ;
244- BuildSelectExpression ( Visit ( fields ) . ToString ( ) , true ) ;
245- return this ;
230+ return InternalSelect ( fields ) ;
231+ }
232+
233+ public virtual SqlExpression < T > Select < Table1 , Table2 , Table3 , Table4 , Table5 , Table6 > ( Expression < Func < Table1 , Table2 , Table3 , Table4 , Table5 , Table6 , object > > fields )
234+ {
235+ return InternalSelect ( fields ) ;
236+ }
237+
238+ public virtual SqlExpression < T > Select < Table1 , Table2 , Table3 , Table4 , Table5 , Table6 , Table7 > ( Expression < Func < Table1 , Table2 , Table3 , Table4 , Table5 , Table6 , Table7 , object > > fields )
239+ {
240+ return InternalSelect ( fields ) ;
241+ }
242+
243+ public virtual SqlExpression < T > SelectDistinct ( Expression < Func < T , object > > fields )
244+ {
245+ return InternalSelect ( fields , distinct : true ) ;
246246 }
247247
248248 public virtual SqlExpression < T > SelectDistinct < Table1 , Table2 > ( Expression < Func < Table1 , Table2 , object > > fields )
249249 {
250- sep = string . Empty ;
251- useFieldName = true ;
252- CustomSelect = true ;
253- BuildSelectExpression ( Visit ( fields ) . ToString ( ) , true ) ;
254- return this ;
250+ return InternalSelect ( fields , distinct : true ) ;
255251 }
256252
257253 public virtual SqlExpression < T > SelectDistinct < Table1 , Table2 , Table3 > ( Expression < Func < Table1 , Table2 , Table3 , object > > fields )
258254 {
259- sep = string . Empty ;
260- useFieldName = true ;
261- CustomSelect = true ;
262- BuildSelectExpression ( Visit ( fields ) . ToString ( ) , true ) ;
263- return this ;
255+ return InternalSelect ( fields , distinct : true ) ;
256+ }
257+
258+ public virtual SqlExpression < T > SelectDistinct < Table1 , Table2 , Table3 , Table4 > ( Expression < Func < Table1 , Table2 , Table3 , Table4 , object > > fields )
259+ {
260+ return InternalSelect ( fields , distinct : true ) ;
261+ }
262+
263+ public virtual SqlExpression < T > SelectDistinct < Table1 , Table2 , Table3 , Table4 , Table5 > ( Expression < Func < Table1 , Table2 , Table3 , Table4 , Table5 , object > > fields )
264+ {
265+ return InternalSelect ( fields , distinct : true ) ;
266+ }
267+
268+ public virtual SqlExpression < T > SelectDistinct < Table1 , Table2 , Table3 , Table4 , Table5 , Table6 > ( Expression < Func < Table1 , Table2 , Table3 , Table4 , Table5 , Table6 , object > > fields )
269+ {
270+ return InternalSelect ( fields , distinct : true ) ;
271+ }
272+
273+ public virtual SqlExpression < T > SelectDistinct < Table1 , Table2 , Table3 , Table4 , Table5 , Table6 , Table7 > ( Expression < Func < Table1 , Table2 , Table3 , Table4 , Table5 , Table6 , Table7 , object > > fields )
274+ {
275+ return InternalSelect ( fields , distinct : true ) ;
264276 }
265277
266278 public virtual SqlExpression < T > SelectDistinct ( )
0 commit comments