joeharrison714 / MVCGrid.Net

http://mvcgrid.net
MIT License
74 stars 55 forks source link

How can async operations be handled? #205

Open JRyanJones opened 3 years ago

JRyanJones commented 3 years ago

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 };
    });