November Happy Hour will be moved to Thursday December 5th.

Make BlockController Index method async

Vote:
 

Hi,

I need the Index method of my blockcontroller to be async but since the base class already has a Index method that is sync this seems impossible. Anyone an idea how to fix this?

The end result I'm looking for will be something like this:

public class MyAsyncBlockController : BlockController
    {
        public async Task Index(MyAsyncBlock currentBlock)
        {
            // async code
        }
    }
#145814
Mar 13, 2016 19:18
Vote:
 

Not 100% but I think you need to wait for future Epi versions to be able to do that.

#145821
Mar 13, 2016 23:29
Vote:
 

Did you solve this?

I'm stuck with the same problem :s

#147046
Apr 05, 2016 10:16
Vote:
 

Hi Jesper,

Nope, I guess we have to (a)wait ;)

#147153
Apr 07, 2016 8:57
Vote:
 

I solved this issue by creating a new base controller to be used instead of BlockController:

public abstract class AsyncBlockController<TContentData> : ActionControllerBase, IRenderTemplate<TContentData>
    where TContentData : IContentData
{
    public abstract Task<ActionResult> Index(TContentData currentContent);
}



#155409
Sep 16, 2016 8:34
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.