You should be able to fetch the data something like this:
public IEnumerable<Person> GetAll()
{
using (var scope = Current.ScopeProvider.CreateScope(autoComplete: true))
{
var sql = new Sql("SELECT * FROM person"); //{Put query as per your requirement}
var people = scope.Database.Fetch<Person>(sql);
return people;
}
return null;
}
If you only need to read data you can use autoComplete: true (default is false, where you also need to scope.Complete(); inside the using statement.
Retrieve a row from a database table
How can I get a row from a database table in umbraco 8 and put it in an API.
Hello husdy,
Refer this example:-
You should be able to fetch the data something like this:
If you only need to read data you can use
autoComplete: true (default is false, where you also need to scope.Complete();
inside the using statement.is working on a reply...