@@ -64,26 +64,24 @@ public void CanDoCountWithInterfaceAndPredicate()
6464 }
6565 }
6666
67- long Count < T > ( IDbConnection db ) where T : IHasId < int > , new ( )
67+ long Count < T > ( IDbConnection db ) where T : IHasId < int >
6868 {
69- T request = new T ( ) ;
70- return db . Scalar < T , long > ( e => Sql . Count ( request . Id ) ) ;
69+ return db . Scalar < T , long > ( e => Sql . Count ( e . Id ) ) ;
7170 }
7271
7372
74- long CountByColumn < T > ( IDbConnection db ) where T : IHasCountColumn , new ( )
73+ long CountByColumn < T > ( IDbConnection db ) where T : IHasCountColumn
7574 {
76- T request = new T ( ) ;
77- return db . Scalar < T , long ? > ( e => Sql . Count ( request . CountColumn ) ) . Value ;
75+ return db . Scalar < T , long ? > ( e => Sql . Count ( e . CountColumn ) ) . Value ;
7876 }
7977
8078
81- int Count < T > ( IDbConnection db , Expression < Func < T , bool > > predicate ) where T : IHasId < int > , new ( )
79+ int Count < T > ( IDbConnection db , Expression < Func < T , bool > > predicate ) where T : IHasId < int >
8280 {
8381 return db . Scalar < T , int > ( e => Sql . Count ( e . Id ) , predicate ) ;
8482 }
8583
86- int CountByColumn < T > ( IDbConnection db , Expression < Func < T , bool > > predicate ) where T : IHasCountColumn , new ( )
84+ int CountByColumn < T > ( IDbConnection db , Expression < Func < T , bool > > predicate ) where T : IHasCountColumn
8785 {
8886 return db . Scalar < T , int ? > ( e => Sql . Count ( e . CountColumn ) , predicate ) . Value ;
8987 }
@@ -109,4 +107,4 @@ public CountTestTable() { }
109107 public int ? CountColumn { get ; set ; }
110108 #endregion
111109 }
112- }
110+ }
0 commit comments