I have @Html.Translate() extension method, which returns translated string. Translations are stored in database, so I want to make async call to database from helper method. Can I make async method calls from razor view? Is here some workaround to call async methods in razor view?
相关问题
- MVC-Routing,Why i can not ignore defaults,The matc
- parameters in routing do not work MVC 3
- What are ES7 Async functions? [closed]
- Custom TaskScheduler, SynchronizationContext?
- There is no ViewData item with the key 'taskTy
相关文章
- How do do an async ServiceController.WaitForStatus
- How to get a list of connected clients on SignalR
- How do you redirect to the calling page in ASP.NET
- Change color of bars depending on value in Highcha
- The program '[4432] iisexpress.exe' has ex
- ASP.Net MVC 4 Bundles
- Efficient signaling Tasks for TPL completions on f
- How to get server path of physical path ?
Async method calls from razor view are supported (or will be supported) only in ASP.NET vNext (MVC 6).
If you are using MVC 5 version and eralier, the simplest solution to your problem would be adding a property to your view model and filling it with async call to db. So when your view is rendered all the data will already be in the model and ready for use.
P.S also calling a database from view sounds a little fishy. May be you should review this pattern.