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