Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个 WebApi 控制器,它需要通过它的构造函数提供服务。如果此服务为空,我通常会抛出一个NullArguementException. 这仍然是在 WebApi 控制器的上下文中失败的正确方法,还是有不同的模式。
NullArguementException
图案是一样的。尽管使用 DI 这会在调用构造函数之前失败。