我已经将Android Studio从2.2更新到2.3,现在当抛出任何异常时,它根本不会出现在"运行"部分.
我得到的只是"应用程序终止"的消息.
即使我故意抛出异常,堆栈跟踪也没有显示......
我需要将一些具有依赖注入的服务注入到动作过滤器中。我熟悉[ServiceFilter]and[TypeFilter]方法,但它有点丑陋、凌乱和不清楚。
有没有办法以正常方式设置过滤器?不包裹我正在使用的过滤器[ServiceFilter]或[TypeFilter]?
例如我想要的:
[SomeFilterWithDI]
[AnotherFilterWithDI("some value")]
public IActionResult Index()
{
return View("Index");
}
Run Code Online (Sandbox Code Playgroud)
代替:
[ServiceFilter(typeof(SomeFilterWithDI))]
[TypeFilter(typeof(AnotherFilterWithDI), Arguments = new string[] { "some value" })]
public IActionResult Index()
{
return View("Index");
}
Run Code Online (Sandbox Code Playgroud)
它看起来很不一样,这种方法对我来说似乎不合适。
c# dependency-injection asp.net-core-mvc asp.net-core asp.net-core-2.1