rename InvokeAsync to InvokeMethodAsync (#529)

This commit is contained in:
vinayada1 2021-01-05 13:41:41 -08:00 committed by GitHub
parent 9fd1900e59
commit c650955f75
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 13 deletions

View File

@ -416,14 +416,14 @@ namespace MyActorClient
// Create Actor Proxy instance to invoke the methods defined in the interface
var proxy = ActorProxy.Create(actorID, actorType);
// Need to specify the method name and response type explicitly
var response = await proxy.InvokeAsync<MyData, string>("SetDataAsync", new MyData()
var response = await proxy.InvokeMethodAsync<MyData, string>("SetDataAsync", new MyData()
{
PropertyA = "ValueA",
PropertyB = "ValueB",
});
Console.WriteLine(response);
var savedData = await proxy.InvokeAsync<MyData>("GetDataAsync");
var savedData = await proxy.InvokeMethodAsync<MyData>("GetDataAsync");
Console.WriteLine(savedData);
}
...

View File

@ -70,12 +70,12 @@ namespace ActorClient
}
}
// Making calls without Remoting, this shows method invocation using InvokeAsync methods, the method name and its payload is provided as arguments to InvokeAsync methods.
// Making calls without Remoting, this shows method invocation using InvokeMethodAsync methods, the method name and its payload is provided as arguments to InvokeMethodAsync methods.
Console.WriteLine("Making calls without Remoting.");
var nonRemotingProxy = ActorProxy.Create(actorId, "DemoActor");
await nonRemotingProxy.InvokeAsync("TestNoArgumentNoReturnType");
await nonRemotingProxy.InvokeAsync("SaveData", data);
var res = await nonRemotingProxy.InvokeAsync<MyData>("GetData");
await nonRemotingProxy.InvokeMethodAsync("TestNoArgumentNoReturnType");
await nonRemotingProxy.InvokeMethodAsync("SaveData", data);
var res = await nonRemotingProxy.InvokeMethodAsync<MyData>("GetData");
Console.WriteLine("Registering the timer and reminder");
await proxy.RegisterTimer();

View File

@ -33,7 +33,7 @@ namespace Dapr.Actors.Builder
// TODO Should this search change to BindingFlags.NonPublic
this.invokeAsyncMethodInfo = this.proxyBaseType.GetMethod(
"InvokeAsync",
"InvokeMethodAsync",
BindingFlags.Instance | BindingFlags.NonPublic,
null,
CallingConventions.Any,
@ -319,7 +319,7 @@ namespace Dapr.Actors.Builder
var objectTask = ilGen.DeclareLocal(typeof(Task<IActorResponseMessageBody>));
// call the base InvokeAsync method
// call the base InvokeMethodAsync method
ilGen.Emit(OpCodes.Ldarg_0); // base
ilGen.Emit(OpCodes.Ldc_I4, interfaceId); // interfaceId
ilGen.Emit(OpCodes.Ldc_I4, methodDescription.Id); // methodId

View File

@ -99,7 +99,7 @@ namespace Dapr.Actors.Client
/// <param name="data">Object argument for actor method.</param>
/// <param name="cancellationToken">Cancellation Token.</param>
/// <returns>Response form server.</returns>
public async Task<TResponse> InvokeAsync<TRequest, TResponse>(string method, TRequest data, CancellationToken cancellationToken = default)
public async Task<TResponse> InvokeMethodAsync<TRequest, TResponse>(string method, TRequest data, CancellationToken cancellationToken = default)
{
using var stream = new MemoryStream();
await JsonSerializer.SerializeAsync<TRequest>(stream, data);
@ -117,7 +117,7 @@ namespace Dapr.Actors.Client
/// <param name="data">Object argument for actor method.</param>
/// <param name="cancellationToken">Cancellation Token.</param>
/// <returns>Response form server.</returns>
public async Task InvokeAsync<TRequest>(string method, TRequest data, CancellationToken cancellationToken = default)
public async Task InvokeMethodAsync<TRequest>(string method, TRequest data, CancellationToken cancellationToken = default)
{
using var stream = new MemoryStream();
await JsonSerializer.SerializeAsync<TRequest>(stream, data);
@ -133,7 +133,7 @@ namespace Dapr.Actors.Client
/// <param name="method">Actor method name.</param>
/// <param name="cancellationToken">Cancellation Token.</param>
/// <returns>Response form server.</returns>
public async Task<TResponse> InvokeAsync<TResponse>(string method, CancellationToken cancellationToken = default)
public async Task<TResponse> InvokeMethodAsync<TResponse>(string method, CancellationToken cancellationToken = default)
{
var response = await this.actorNonRemotingClient.InvokeActorMethodWithoutRemotingAsync(this.ActorType, this.ActorId.ToString(), method, null, cancellationToken);
return await JsonSerializer.DeserializeAsync<TResponse>(response);
@ -145,7 +145,7 @@ namespace Dapr.Actors.Client
/// <param name="method">Actor method name.</param>
/// <param name="cancellationToken">Cancellation Token.</param>
/// <returns>Response form server.</returns>
public Task InvokeAsync(string method, CancellationToken cancellationToken = default)
public Task InvokeMethodAsync(string method, CancellationToken cancellationToken = default)
{
return this.actorNonRemotingClient.InvokeActorMethodWithoutRemotingAsync(this.ActorType, this.ActorId.ToString(), method, null, cancellationToken);
}
@ -186,7 +186,7 @@ namespace Dapr.Actors.Client
/// <param name="requestMsgBodyValue">Request Message Body Value.</param>
/// <param name="cancellationToken">Cancellation Token.</param>
/// <returns>A <see cref="Task{TResult}"/> representing the result of the asynchronous operation.</returns>
protected async Task<IActorResponseMessageBody> InvokeAsync(
protected async Task<IActorResponseMessageBody> InvokeMethodAsync(
int interfaceId,
int methodId,
string methodName,