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