我可能无法为任何人提供足够的信息/洞察力来完全回答这个问题,但我希望通过给出最好的概述我能够解决这个问题嘎吱嘎吱的,足以帮助他们。
我试图跟踪REST调用通过我的代码所经历的路径,这样我就可以看到如何在某个时刻获取它,而不是去那里(它去哪里)。 / p>
具体来说,我不知道为什么GetCount()方法在这里:
namespace NRBQ.Client
{
public class RESTNRBQDelivery : INRBQDelivery
{
INRBQClientSettings NRBQClientSettings;
IRESTAPIClient RESTAPIClient;
public RESTNRBQDelivery(IRESTAPIClient RESTAPIClient, INRBQClientSettings NRBQClientSettings)
{
this.NRBQClientSettings = NRBQClientSettings;
this.RESTAPIClient = RESTAPIClient;
}
public RESTNRBQDelivery(IRESTAPIClient RESTAPIClient, INRBQClientSettings NRBQClientSettings, AuthenticationHeaderValue AuthHeader)
{
this.NRBQClientSettings = NRBQClientSettings;
this.RESTAPIClient = RESTAPIClient;
this.RESTAPIClient.AuthHeader = AuthHeader;
}
public int GetCount()
{
var res = RESTAPIClient.GET<int>(0
, new Uri(NRBQClientSettings.NRBQAPI)
, "api/deliveries/Count"
);
if (res.status != RequestResultStatus.Success)
{
throw new Exception(res.message);
}
return res.result;
}
...称之为:
namespace SeaStore.Data.Legacy.NRBQ
{
public class NRBQSQLRepository : INRBQRepositoryInterface
{
private INRBQRepositorySettings Settings;
private IMSAccessHelper MSAccessHelper;
public NRBQSQLRepository(INRBQRepositorySettings settings, IMSAccessHelper MSAccessHelper)
{
this.Settings = settings;
this.MSAccessHelper = MSAccessHelper;
}
public int GetNRBQEntity()
{
. . . // this is the method that is called
我希望它会调用这个类,它位于与上面代码相同的文件夹下:
namespace SeaStore.Data.Legacy.NRBQ
{
public class NRBQDeliveryRepository : INRBQDeliveryRepository
{
private INRBQRepositorySettings Settings;
private IMSAccessHelper MSAccessHelper;
public NRBQDeliveryRepository(INRBQRepositorySettings settings, IMSAccessHelper MSAccessHelper)
{
this.Settings = settings;
this.MSAccessHelper = MSAccessHelper;
}
public int GetCount()
{
return 42; // <= I want it to go to here, not to its sibling
}
再一次,这只是熔岩的一角,而且我知道从这个信息中得到答案是不合理的,但是:是否有一些工具或程序可以用来说明为什么通过代码的路径采用这个分叉而不是其他分支?