本文介绍了如何使用reprository和service调用webapi控制器参数化构造函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要使用reprository和web-API的参数化构造函数的示例示例
我尝试过:
我试过这个:
public class TestUsersUserControlController:ApiController
{
private readonly IConnectUserRepository ConnectUserRepository;
public TestUsersUserControlController()
{
}
public TestUsersUserControlController(IConnectUserRepository ConnectUserRepository)
{
this .ConnectUserRepository = ConnectUserRepository; ....... .. 此参数化构造函数 未点击并始终 null
}
解决方案
I need some sample example with parameterized constructor using reprository and web-API
What I have tried:
I tried this:
public class TestUsersUserControlController : ApiController { private readonly IConnectUserRepository ConnectUserRepository; public TestUsersUserControlController() { } public TestUsersUserControlController(IConnectUserRepository ConnectUserRepository) { this.ConnectUserRepository = ConnectUserRepository;.........this parameterized constructor is not hitting and getting always null }
解决方案
这篇关于如何使用reprository和service调用webapi控制器参数化构造函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!