Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public class BindingController(DaprClient client, ILogger<BindingController> log
private string appId = Environment.GetEnvironmentVariable("APP_ID");

[HttpPost("cronbinding")]
[Obsolete]
public async Task<IActionResult> HandleBindingEvent()
{
logger.LogInformation("Received binding event on {appId}, scanning for work.", appId);
Expand All @@ -39,6 +40,7 @@ public async Task<IActionResult> HandleBindingEvent()
return Ok();
}

[Obsolete]
private async Task AttemptToProcessFile(string fileName)
{
// Locks are Disposable and will automatically unlock at the end of a 'using' statement.
Expand Down Expand Up @@ -76,6 +78,7 @@ private async Task AttemptToProcessFile(string fileName)
}
}

[Obsolete]
private async Task<StateData> GetFile(string fileName)
{
try
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ public class GeneratorService
{
Timer generateDataTimer;

[Obsolete]
public GeneratorService()
{
// Generate some data every second.
Expand All @@ -18,14 +19,16 @@ public GeneratorService()
}
}

[Obsolete]
public async void GenerateData(Object stateInfo)
{
using (var client = new DaprClientBuilder().Build())
{
var rand = new Random();
var state = new StateData(rand.Next(100));

// NOTE: It is no longer best practice to use this method - this example will be modified in the 1.18 release
await client.InvokeBindingAsync("localstorage", "create", state);
}
}
}
}
5 changes: 3 additions & 2 deletions examples/Client/DistributedLock/Startup.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Dapr.AspNetCore;
using System;
using DistributedLock.Services;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
Expand All @@ -18,6 +18,7 @@ public Startup(IConfiguration configuration)
public IConfiguration Configuration { get; }

// This method gets called by the runtime. Use this method to add services to the container.
[Obsolete]
public void ConfigureServices(IServiceCollection services)
{
services.AddControllers().AddDapr();
Expand All @@ -42,4 +43,4 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
endpoints.MapControllers();
});
}
}
}
3 changes: 3 additions & 0 deletions src/Dapr.Client/DaprClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ public abstract Task PublishByteEventAsync(
/// <param name="metadata">A collection of metadata key-value pairs that will be provided to the binding. The valid metadata keys and values are determined by the type of binding used.</param>
/// <param name="cancellationToken">A <see cref="CancellationToken" /> that can be used to cancel the operation.</param>
/// <returns>A <see cref="Task" /> that will complete when the operation has completed.</returns>
[Obsolete("Recommended guidance is to use a native HTTP or gRPC client for service invocation")]
public abstract Task InvokeBindingAsync<TRequest>(
string bindingName,
string operation,
Expand All @@ -274,6 +275,7 @@ public abstract Task InvokeBindingAsync<TRequest>(
/// <param name="metadata">A collection of metadata key-value pairs that will be provided to the binding. The valid metadata keys and values are determined by the type of binding used.</param>
/// <param name="cancellationToken">A <see cref="CancellationToken" /> that can be used to cancel the operation.</param>
/// <returns>A <see cref="Task{T}" /> that will complete when the operation has completed.</returns>
[Obsolete("Recommended guidance is to use a native HTTP or gRPC client for service invocation")]
public abstract Task<TResponse> InvokeBindingAsync<TRequest, TResponse>(
string bindingName,
string operation,
Expand All @@ -288,6 +290,7 @@ public abstract Task<TResponse> InvokeBindingAsync<TRequest, TResponse>(
/// <param name="request">The <see cref="BindingRequest" /> to send.</param>
/// <param name="cancellationToken">A <see cref="CancellationToken" /> that can be used to cancel the operation.</param>
/// <returns>A <see cref="Task{T}" /> that will complete when the operation has completed.</returns>
[Obsolete("Recommended guidance is to use a native HTTP or gRPC client for service invocation")]
public abstract Task<BindingResponse> InvokeBindingAsync(
BindingRequest request,
CancellationToken cancellationToken = default);
Expand Down
5 changes: 4 additions & 1 deletion src/Dapr.Client/DaprClientGrpc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ private async Task<BulkPublishResponse<TValue>> MakeBulkPublishRequest<TValue>(
#region InvokeBinding Apis

/// <inheritdoc/>
[Obsolete("Recommended guidance is to use a native HTTP or gRPC client for service invocation")]
public override async Task InvokeBindingAsync<TRequest>(
string bindingName,
string operation,
Expand All @@ -288,6 +289,7 @@ public override async Task InvokeBindingAsync<TRequest>(
}

/// <inheritdoc/>
[Obsolete("Recommended guidance is to use a native HTTP or gRPC client for service invocation")]
public override async Task<TResponse> InvokeBindingAsync<TRequest, TResponse>(
string bindingName,
string operation,
Expand All @@ -313,6 +315,7 @@ public override async Task<TResponse> InvokeBindingAsync<TRequest, TResponse>(
}
}

[Obsolete("Recommended guidance is to use a native HTTP or gRPC client for service invocation")]
public override async Task<BindingResponse> InvokeBindingAsync(BindingRequest request,
CancellationToken cancellationToken = default)
{
Expand Down Expand Up @@ -2283,7 +2286,7 @@ private CallOptions CreateCallOptions(Metadata headers, CancellationToken cancel
{
options.Headers.Add("User-Agent", UserAgent().ToString());

// add token for dapr api token based authentication
// add token for dapr api token-based authentication
if (this.apiTokenHeader is not null)
{
options.Headers.Add(this.apiTokenHeader.Value.Key, this.apiTokenHeader.Value.Value);
Expand Down
3 changes: 2 additions & 1 deletion test/Dapr.Client.Test/InvokeBindingApiTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
// limitations under the License.
// ------------------------------------------------------------------------

#pragma warning disable CS0618 // Type or member is obsolete
namespace Dapr.Client.Test;

using System;
Expand Down Expand Up @@ -308,4 +309,4 @@ private class Widget
{
public string Color { get; set; }
}
}
}
Loading