You need to run a query using the Entity Framework Core:
SELECT to_seconds(now()) - to_seconds(lastaccess) as seconds FROM survey WHERE id=@param This code does not work:
var i = _db.Database.FromSql<int>( @"SELECT to_seconds(now()) - to_seconds(lastaccess) as seconds FROM survey WHERE id=@param;", @param).ToList(); Writes that 'DatabaseFacade "does not contain a definition for" FromSql "
I tried to turn this field into an entity by making it NotMapped:
entity.Property(e =>e.LastAccessComputed) .HasComputedColumnSql("to_seconds(now()) - to_seconds(lastaccess)"); In this case, the base swears, because she searches for a field in the table.
How to get the result of such a query?