From 0604b5e28c4a7bc2e5bc69475866c448fa13338d Mon Sep 17 00:00:00 2001 From: martincostello Date: Wed, 26 Jul 2023 12:50:07 +0100 Subject: [PATCH] Fix samples - Rename `ExecuteCoreAsync` to `ExecuteCore`. - Remove `StrategyType`. --- samples/Extensibility/Program.cs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/samples/Extensibility/Program.cs b/samples/Extensibility/Program.cs index 35a31dfb887..c9e27adfba9 100644 --- a/samples/Extensibility/Program.cs +++ b/samples/Extensibility/Program.cs @@ -33,7 +33,10 @@ internal class MySimpleStrategy : ResilienceStrategy { - protected override ValueTask> ExecuteCoreAsync(Func>> callback, ResilienceContext context, TState state) + protected override ValueTask> ExecuteCore( + Func>> callback, + ResilienceContext context, + TState state) { Console.WriteLine("MySimpleStrategy executing!"); @@ -64,8 +67,6 @@ protected override ValueTask> ExecuteCoreAsync // 1.B Define the options. public class MyResilienceStrategyOptions : ResilienceStrategyOptions { - public override string StrategyType => "MyCustomStrategy"; - // Use the arguments in the delegates. // The recommendation is to use asynchronous delegates. public Func? OnCustomEvent { get; set; } @@ -87,7 +88,10 @@ public MyResilienceStrategy(ResilienceStrategyTelemetry telemetry, MyResilienceS this.onCustomEvent = options.OnCustomEvent; } - protected override async ValueTask> ExecuteCoreAsync(Func>> callback, ResilienceContext context, TState state) + protected override async ValueTask> ExecuteCore( + Func>> callback, + ResilienceContext context, + TState state) { // Here, do something before callback execution // ... @@ -129,5 +133,3 @@ public static TBuilder AddMyResilienceStrategy(this TBuilder builder, // Pass the options, note that the options instance is automatically validated by the builder options); } - -