score:1

Accepted answer

this is asynchronous:

var query2 = getalerts(i => i.organisationid == organisationid && (begindate == null || i.createdat <= enddate) && (enddate == null || i.createdat >= begindate));

return await query2.tolistasync();

as @weichch has mentioned, getalerts doesn't execute anything in the database:

entity framework core provides a set of async extension methods similar to the linq methods, which execute a query and return results. examples include tolistasync(), toarrayasync(), singleasync(). there are no async versions of some linq operators such as where(...) or orderby(...) because these methods only build up the linq expression tree and don't cause the query to be executed in the database.


Related Query

More Query from same tag