@@ -63,26 +63,24 @@ public void CanDoCountWithInterfaceAndPredicate()
6363 }
6464 }
6565
66- long Count < T > ( IDbConnection db ) where T : IHasId < int > , new ( )
66+ long Count < T > ( IDbConnection db ) where T : IHasId < int >
6767 {
68- T request = new T ( ) ;
69- return db . Scalar < T , long > ( e => Sql . Count ( request . Id ) ) ;
68+ return db . Scalar < T , long > ( e => Sql . Count ( e . Id ) ) ;
7069 }
7170
7271
73- long CountByColumn < T > ( IDbConnection db ) where T : IHasCountColumn , new ( )
72+ long CountByColumn < T > ( IDbConnection db ) where T : IHasCountColumn
7473 {
75- T request = new T ( ) ;
76- return db . Scalar < T , long ? > ( e => Sql . Count ( request . CountColumn ) ) . Value ;
74+ return db . Scalar < T , long ? > ( e => Sql . Count ( e . CountColumn ) ) . Value ;
7775 }
7876
7977
80- int Count < T > ( IDbConnection db , Expression < Func < T , bool > > predicate ) where T : IHasId < int > , new ( )
78+ int Count < T > ( IDbConnection db , Expression < Func < T , bool > > predicate ) where T : IHasId < int >
8179 {
8280 return db . Scalar < T , int > ( e => Sql . Count ( e . Id ) , predicate ) ;
8381 }
8482
85- int CountByColumn < T > ( IDbConnection db , Expression < Func < T , bool > > predicate ) where T : IHasCountColumn , new ( )
83+ int CountByColumn < T > ( IDbConnection db , Expression < Func < T , bool > > predicate ) where T : IHasCountColumn
8684 {
8785 return db . Scalar < T , int ? > ( e => Sql . Count ( e . CountColumn ) , predicate ) . Value ;
8886 }
@@ -108,4 +106,4 @@ public CountTestTable() { }
108106 public int ? CountColumn { get ; set ; }
109107 #endregion
110108 }
111- }
109+ }
0 commit comments