@@ -65,26 +65,24 @@ public void CanDoCountWithInterfaceAndPredicate()
6565 }
6666 }
6767
68- long Count < T > ( IDbConnection db ) where T : IHasId < int > , new ( )
68+ long Count < T > ( IDbConnection db ) where T : IHasId < int >
6969 {
70- T request = new T ( ) ;
71- return db . Scalar < T , long > ( e => Sql . Count ( request . Id ) ) ;
70+ return db . Scalar < T , long > ( e => Sql . Count ( e . Id ) ) ;
7271 }
7372
7473
75- long CountByColumn < T > ( IDbConnection db ) where T : IHasCountColumn , new ( )
74+ long CountByColumn < T > ( IDbConnection db ) where T : IHasCountColumn
7675 {
77- T request = new T ( ) ;
78- return db . Scalar < T , long ? > ( e => Sql . Count ( request . CountColumn ) ) . Value ;
76+ return db . Scalar < T , long ? > ( e => Sql . Count ( e . CountColumn ) ) . Value ;
7977 }
8078
8179
82- int Count < T > ( IDbConnection db , Expression < Func < T , bool > > predicate ) where T : IHasId < int > , new ( )
80+ int Count < T > ( IDbConnection db , Expression < Func < T , bool > > predicate ) where T : IHasId < int >
8381 {
8482 return db . Scalar < T , int > ( e => Sql . Count ( e . Id ) , predicate ) ;
8583 }
8684
87- int CountByColumn < T > ( IDbConnection db , Expression < Func < T , bool > > predicate ) where T : IHasCountColumn , new ( )
85+ int CountByColumn < T > ( IDbConnection db , Expression < Func < T , bool > > predicate ) where T : IHasCountColumn
8886 {
8987 return db . Scalar < T , int ? > ( e => Sql . Count ( e . CountColumn ) , predicate ) . Value ;
9088 }
@@ -110,4 +108,4 @@ public CountTestTable() { }
110108 public int ? CountColumn { get ; set ; }
111109 #endregion
112110 }
113- }
111+ }
0 commit comments