@@ -63,26 +63,24 @@ public void CanDoCountWithInterfaceAndPredicate()
63
63
}
64
64
}
65
65
66
- long Count < T > ( IDbConnection db ) where T : IHasId < int > , new ( )
66
+ long Count < T > ( IDbConnection db ) where T : IHasId < int >
67
67
{
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 ) ) ;
70
69
}
71
70
72
71
73
- long CountByColumn < T > ( IDbConnection db ) where T : IHasCountColumn , new ( )
72
+ long CountByColumn < T > ( IDbConnection db ) where T : IHasCountColumn
74
73
{
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 ;
77
75
}
78
76
79
77
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 >
81
79
{
82
80
return db . Scalar < T , int > ( e => Sql . Count ( e . Id ) , predicate ) ;
83
81
}
84
82
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
86
84
{
87
85
return db . Scalar < T , int ? > ( e => Sql . Count ( e . CountColumn ) , predicate ) . Value ;
88
86
}
@@ -108,4 +106,4 @@ public CountTestTable() { }
108
106
public int ? CountColumn { get ; set ; }
109
107
#endregion
110
108
}
111
- }
109
+ }
0 commit comments