I need to create in my application a feature that checks the database ( PostGreSQL
) for the percentage of storage space used to be displayed on a chart.
I have a generic repository, and I thought about creating a GetStorage()
function, but I have no idea how this should be done, because I do not know if EF Core
has this feature, should that be done using Script SQL
?
Something similar to the code below, but returning the percentage:
public decimal GetStorage()
{
var valor = Db.FromSql("SELECT pg_size_pretty(pg_database_size('SistemaComercial'));";
return valor;
}