Browse Source

Solve the case of duplicate parameter types

pull/10139/head
maliming 5 years ago
parent
commit
e821c8502c
  1. 4
      framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/ClientProxying/ClientProxyBase.cs
  2. 12
      framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/ClientProxying/ClientProxyRequestTypeValue.cs

4
framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/ClientProxying/ClientProxyBase.cs

@ -55,7 +55,7 @@ namespace Volo.Abp.Http.Client.ClientProxying
arguments = new ClientProxyRequestTypeValue();
}
var methodUniqueName = $"{typeof(TService).FullName}.{methodName}.{string.Join("-", arguments.Select(x => x.Key.FullName))}";
var methodUniqueName = $"{typeof(TService).FullName}.{methodName}.{string.Join("-", arguments.Values.Select(x => x.Key.FullName))}";
var action = ClientProxyApiDescriptionFinder.FindAction(methodUniqueName);
if (action == null)
{
@ -65,7 +65,7 @@ namespace Volo.Abp.Http.Client.ClientProxying
action,
action.Parameters
.GroupBy(x => x.NameOnMethod)
.Select((x, i) => new KeyValuePair<string, object>(x.Key, arguments.Values.Skip(i).FirstOrDefault()))
.Select((x, i) => new KeyValuePair<string, object>(x.Key, arguments.Values.Skip(i).First().Value))
.ToDictionary(x => x.Key, x => x.Value),
typeof(TService));
}

12
framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/ClientProxying/ClientProxyRequestTypeValue.cs

@ -3,8 +3,18 @@ using System.Collections.Generic;
namespace Volo.Abp.Http.Client.ClientProxying
{
public class ClientProxyRequestTypeValue : Dictionary<Type, object>
public class ClientProxyRequestTypeValue
{
public List<KeyValuePair<Type, object>> Values { get; private set; }
public ClientProxyRequestTypeValue()
{
Values = new List<KeyValuePair<Type, object>>();
}
public void Add(Type type, object value)
{
Values.Add(new KeyValuePair<Type, object>(type, value));
}
}
}

Loading…
Cancel
Save