Joe*_*tte 7 asp.net-core-mvc asp.net-core
在beta6中,我们能够像这样插入自定义视图引擎:
services.AddMvc()
.AddViewOptions(options =>
{
options.ViewEngines.Clear();
options.ViewEngines.Add(typeof(MyCustomViewEngine));
});
Run Code Online (Sandbox Code Playgroud)
这不再适用于beta7和options.ViewEngines似乎已经改为
IList<IViewEngine>
Run Code Online (Sandbox Code Playgroud)
我不明白如何插入一个而不必新建它并提供其依赖
options.ViewEngines.Add(new it up here?);
Run Code Online (Sandbox Code Playgroud)
如何在beta7中插入我自己的自定义视图引擎?
在打电话之前我弄清楚了
services.AddMvc()
Run Code Online (Sandbox Code Playgroud)
我需要将我的viewengine添加到DI
services.TryAddSingleton<IRazorViewEngine, MyCustomViewEngine>();
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
869 次 |
最近记录: |