I'm trying to create a stats page on my website that shows how many rows have been added to a specific table in the last X minutes.
This is the first thing I tried:
int games = db.GameLogs.Where(t => t.GameEnded > DateTime.Now - TimeSpan.FromMinutes(1)).Count();
I get this ugly error:
This is the second thing I tried:
var games = db.GameLogs.FromSqlRaw("select count(*) from mtgbattles.gamelogs where gameended > now() - interval 1 minute");
I get the error:
InvalidOperationException: The required column 'Id' was not present in the results of a 'FromSql' operation.
The query works fine in MySQL Workbench.
