Skip to content

Commit d57f1af

Browse files
committed
Move snippets to src folder
1 parent e9e2572 commit d57f1af

File tree

15 files changed

+65
-62
lines changed

15 files changed

+65
-62
lines changed

.github/workflows/on-push-do-docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: on-push-do-docs
33
on:
44
push:
55
branches: [main]
6-
paths: [ "samples/Snippets/**" ]
6+
paths: [ "src/Snippets/**" ]
77
workflow_dispatch:
88

99
permissions:

Polly.sln

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Polly.Testing", "src\Polly.
5656
EndProject
5757
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Polly.Testing.Tests", "test\Polly.Testing.Tests\Polly.Testing.Tests.csproj", "{D333B5CE-982D-4C11-BDAF-4217AA02306E}"
5858
EndProject
59+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Snippets", "src\Snippets\Snippets.csproj", "{D812B941-79B0-4E1E-BB70-4FAE345B5234}"
60+
EndProject
5961
Global
6062
GlobalSection(SolutionConfigurationPlatforms) = preSolution
6163
Debug|Any CPU = Debug|Any CPU
@@ -114,6 +116,10 @@ Global
114116
{D333B5CE-982D-4C11-BDAF-4217AA02306E}.Debug|Any CPU.Build.0 = Debug|Any CPU
115117
{D333B5CE-982D-4C11-BDAF-4217AA02306E}.Release|Any CPU.ActiveCfg = Release|Any CPU
116118
{D333B5CE-982D-4C11-BDAF-4217AA02306E}.Release|Any CPU.Build.0 = Release|Any CPU
119+
{D812B941-79B0-4E1E-BB70-4FAE345B5234}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
120+
{D812B941-79B0-4E1E-BB70-4FAE345B5234}.Debug|Any CPU.Build.0 = Debug|Any CPU
121+
{D812B941-79B0-4E1E-BB70-4FAE345B5234}.Release|Any CPU.ActiveCfg = Release|Any CPU
122+
{D812B941-79B0-4E1E-BB70-4FAE345B5234}.Release|Any CPU.Build.0 = Release|Any CPU
117123
EndGlobalSection
118124
GlobalSection(SolutionProperties) = preSolution
119125
HideSolutionNode = FALSE
@@ -133,6 +139,7 @@ Global
133139
{C04DEE61-C1EA-4028-B457-CDBD304B8ED9} = {A6CC41B9-E0B9-44F8-916B-3E4A78DA3BFB}
134140
{9AD2D6AD-56E4-49D6-B6F1-EE975D5760B9} = {B7BF406B-B06F-4025-83E6-7219C53196A6}
135141
{D333B5CE-982D-4C11-BDAF-4217AA02306E} = {A6CC41B9-E0B9-44F8-916B-3E4A78DA3BFB}
142+
{D812B941-79B0-4E1E-BB70-4FAE345B5234} = {B7BF406B-B06F-4025-83E6-7219C53196A6}
136143
EndGlobalSection
137144
GlobalSection(ExtensibilityGlobals) = postSolution
138145
SolutionGuid = {2E5D54CD-770A-4345-B585-1848FC2EA6F4}

mdsnippets.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"$schema": "https://raw.githubusercontent.com/SimonCropp/MarkdownSnippets/main/schema.json",
33
"ExcludeDirectories": [ "test", "artifacts", "bench", "eng" ],
4-
"ExcludeSnippetDirectories": [ "src", "artifacts", "test" ],
4+
"ExcludeSnippetDirectories": [ "src/Polly", "src/Polly.Core", "src/Polly.RateLimiting", "src/Polly.Testing", "src/Polly.Extensions", "artifacts", "test" ],
55
"OmitSnippetLinks": true,
66
"Convention": "InPlaceOverwrite"
77
}

samples/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,5 @@ This repository contains a solution with basic examples demonstrating the creati
77
- [`Retries`](./Retries) - This part explains how to configure a retry resilience strategy.
88
- [`Extensibility`](./Extensibility) - In this part, you can learn how Polly can be extended with custom resilience strategies.
99
- [`DependencyInjection`](./DependencyInjection) - This section demonstrates the integration of Polly with `IServiceCollection`.
10-
- [`Snippets`](./Snippets) - Various code-snippets that are referenced in the documentation.
1110

1211
These examples are designed as a quick-start guide to Polly. If you wish to explore more advanced scenarios and further enhance your learning, consider visiting the [Polly-Samples](https://github.com/App-vNext/Polly-Samples) repository.

samples/Samples.sln

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Retries", "Retries\Retries.
2020
EndProject
2121
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DependencyInjection", "DependencyInjection\DependencyInjection.csproj", "{9B8BFE03-4457-4C55-91AD-4096DDE622C3}"
2222
EndProject
23-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Snippets", "Snippets\Snippets.csproj", "{E112D575-A3CD-41DA-8BE9-9D9C5A008F7D}"
24-
EndProject
2523
Global
2624
GlobalSection(SolutionConfigurationPlatforms) = preSolution
2725
Debug|Any CPU = Debug|Any CPU
@@ -48,10 +46,6 @@ Global
4846
{9B8BFE03-4457-4C55-91AD-4096DDE622C3}.Debug|Any CPU.Build.0 = Debug|Any CPU
4947
{9B8BFE03-4457-4C55-91AD-4096DDE622C3}.Release|Any CPU.ActiveCfg = Release|Any CPU
5048
{9B8BFE03-4457-4C55-91AD-4096DDE622C3}.Release|Any CPU.Build.0 = Release|Any CPU
51-
{E112D575-A3CD-41DA-8BE9-9D9C5A008F7D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
52-
{E112D575-A3CD-41DA-8BE9-9D9C5A008F7D}.Debug|Any CPU.Build.0 = Debug|Any CPU
53-
{E112D575-A3CD-41DA-8BE9-9D9C5A008F7D}.Release|Any CPU.ActiveCfg = Release|Any CPU
54-
{E112D575-A3CD-41DA-8BE9-9D9C5A008F7D}.Release|Any CPU.Build.0 = Release|Any CPU
5549
EndGlobalSection
5650
GlobalSection(SolutionProperties) = preSolution
5751
HideSolutionNode = FALSE

samples/Snippets/Program.cs

Lines changed: 0 additions & 3 deletions
This file was deleted.

samples/Snippets/Snippets.csproj

Lines changed: 0 additions & 20 deletions
This file was deleted.

src/Polly.Core/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,6 @@ Below are some examples illustrating the usage of these delegates:
220220
new ResiliencePipelineBuilder()
221221
.AddRetry(new RetryStrategyOptions
222222
{
223-
224223
// Non-Generic predicate for multiple result types
225224
ShouldHandle = args => args.Outcome switch
226225
{

src/Polly.Extensions/README.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ var pipelineProvider = serviceProvider.GetRequiredService<ResiliencePipelineProv
3131
var pipeline = pipelineProvider.GetPipeline("my-key");
3232

3333
// Use it
34-
await pipeline.ExecuteAsync(async cancellation => await Task.Delay(100));
34+
await pipeline.ExecuteAsync(async cancellation => await Task.Delay(100, cancellation));
3535
```
3636
<!-- endSnippet -->
3737

@@ -44,10 +44,11 @@ Upon invoking the `ConfigureTelemetry` extension method, Polly begins to emit lo
4444

4545
<!-- snippet: configure-telemetry -->
4646
```cs
47-
var telemetryOptions = new TelemetryOptions();
48-
49-
// Configure logging
50-
telemetryOptions.LoggerFactory = LoggerFactory.Create(builder => builder.AddConsole());
47+
var telemetryOptions = new TelemetryOptions
48+
{
49+
// Configure logging
50+
LoggerFactory = LoggerFactory.Create(builder => builder.AddConsole())
51+
};
5152

5253
// Configure enrichers
5354
telemetryOptions.MeteringEnrichers.Add(new MyMeteringEnricher());
@@ -64,15 +65,15 @@ var builder = new ResiliencePipelineBuilder()
6465

6566
<!-- snippet: telemetry-listeners -->
6667
```cs
67-
class MyTelemetryListener : TelemetryListener
68+
internal class MyTelemetryListener : TelemetryListener
6869
{
6970
public override void Write<TResult, TArgs>(in TelemetryEventArguments<TResult, TArgs> args)
7071
{
7172
Console.WriteLine($"Telemetry event occurred: {args.Event.EventName}");
7273
}
7374
}
7475

75-
class MyMeteringEnricher : MeteringEnricher
76+
internal class MyMeteringEnricher : MeteringEnricher
7677
{
7778
public override void Enrich<TResult, TArgs>(in EnrichmentContext<TResult, TArgs> context)
7879
{
Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33

44
namespace Snippets.Core;
55

6-
#pragma warning disable IDE0022 // Use expression body for method
7-
#pragma warning disable IDE0021 // Use expression body for constructor
8-
96
internal static class Snippets
107
{
118
public static void NonGenericPipeline()
@@ -89,7 +86,6 @@ public MyCustomStrategyOptions()
8986

9087
#endregion
9188

92-
9389
#region my-custom-strategy
9490

9591
internal class MyCustomStrategy : ResilienceStrategy
@@ -118,7 +114,6 @@ public static void DelegateUsage()
118114
new ResiliencePipelineBuilder()
119115
.AddRetry(new RetryStrategyOptions
120116
{
121-
122117
// Non-Generic predicate for multiple result types
123118
ShouldHandle = args => args.Outcome switch
124119
{

0 commit comments

Comments
 (0)