Skip to content
This repository was archived by the owner on Dec 24, 2022. It is now read-only.

Commit 79927fd

Browse files
Update OrmLiteCountTests.cs
fix methods "long Count(IDbConnection db)" and "long CountByColumn(IDbConnection db)"
1 parent 9c33657 commit 79927fd

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/ServiceStack.OrmLite.MySql.Tests/Expressions/OrmLiteCountTests.cs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,17 +64,15 @@ public void CanDoCountWithInterfaceAndPredicate()
6464
}
6565
}
6666

67-
long Count<T>(IDbConnection db) where T : IHasId<int>, new()
67+
long Count<T>(IDbConnection db) where T : IHasId<int>
6868
{
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));
7170
}
7271

7372

74-
long CountByColumn<T>(IDbConnection db) where T : IHasCountColumn, new()
73+
long CountByColumn<T>(IDbConnection db) where T : IHasCountColumn
7574
{
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;
7876
}
7977

8078

@@ -109,4 +107,4 @@ public CountTestTable() { }
109107
public int? CountColumn { get; set; }
110108
#endregion
111109
}
112-
}
110+
}

0 commit comments

Comments
 (0)