改装继承未命中方法

时间:2019-04-12 11:54:22

标签: refit

我们将Refit用于API声明,并希望使用接口继承。 这里显示了一个示例:https://github.com/reactiveui/refit#interface-inheritance

public interface IPlatformRestClient
{
    HttpClient Client { get; }

    [Get("/version")]
    Task<string> GetVersion();
}

public interface ITestRestClient : IPlatformRestClient
{
    [Get("/test")]
    Task<string> Test();
}

我可能是瞎子,做错了什么,但是构造导致以下错误消息

  

'AutoGeneratedITestRestClient'未实现接口成员'IPlatformRestClient.GetVersion()'Platform.RestClient.UnitTests

如果我打开存根:

/// <inheritdoc />
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
[global::System.Diagnostics.DebuggerNonUserCode]
[Preserve]
[global::System.Reflection.Obfuscation(Exclude=true)]
partial class AutoGeneratedITestRestClient : ITestRestClient
{
    /// <inheritdoc />
    public HttpClient Client { get; protected set; }
    readonly IRequestBuilder requestBuilder;

    /// <inheritdoc />
    public AutoGeneratedITestRestClient(HttpClient client, IRequestBuilder requestBuilder)
    {
        Client = client;
        this.requestBuilder = requestBuilder;
    }

    /// <inheritdoc />
    Task<string> ITestRestClient.Test()
    {
        var arguments = new object[] {  };
        var func = requestBuilder.BuildRestResultFuncForMethod("Test", new Type[] {  });
        return (Task<string>)func(Client, arguments);
    }
}

这个功能坏了还是我有什么错误?

0 个答案:

没有答案