MVCGrid.Net icon indicating copy to clipboard operation
MVCGrid.Net copied to clipboard

How can async operations be handled?

Open JRyanJones opened this issue 5 years ago • 0 comments

For performance and throughput purposes, I'd like to handle RetrieveData/WithRetrieveDataMethod using async operations. Is there a way to accomplish this?

Something like:

MVCGridDefinitionTable.Add("MyGrid", new MVCGridBuilder<MyViewModel>()
    .AddColumns(...)
    .WithRetrieveDataMethodAsync(async (context) =>
    {
        IMyDataRepo dataRepo = IoC.Resolve<IMyDataRepo>();
        List<MyViewModel> data = await dataRepo.GetData(...);
        return new QueryResult<MyViewModel>() { Items = data, Total = total };
    });

JRyanJones avatar Oct 27 '20 00:10 JRyanJones