Skip to content

Commit 7e18fd6

Browse files
Tidy
1 parent 119e108 commit 7e18fd6

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

src/Example/Program.cs

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,17 @@ static void Main()
1313
var config = BuildConfig();
1414

1515
ServiceCollection services = new ServiceCollection();
16-
services.AddShortCodeGenerator<SequentialCodeGenerator>(options =>
17-
{
18-
options.Pattern = new[]
19-
{
20-
new PatternOptions(NamedCharacterSpaces.UpperLatinLetters, 3),
21-
new PatternOptions("-"),
22-
new PatternOptions(NamedCharacterSpaces.Digits, 3),
23-
};
24-
});
16+
services.AddShortCodeGenerator<SequentialCodeGenerator>(config);
17+
// Alternative - Build the options in code.
18+
// services.AddShortCodeGenerator<SequentialCodeGenerator>(options =>
19+
// {
20+
// options.Pattern = new[]
21+
// {
22+
// new PatternOptions(NamedCharacterSpaces.UpperLatinLetters, 3),
23+
// new PatternOptions("-"),
24+
// new PatternOptions(NamedCharacterSpaces.Digits, 3),
25+
// };
26+
// });
2527

2628
ServiceProvider provider = services.BuildServiceProvider();
2729
var factory = provider.GetRequiredService<IShortCodeFactory>();

src/Stravaig.ShortCode.DependencyInjection/ServiceProviderExtensions.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using System;
2-
using System.Collections.Generic;
32
using System.Linq;
43
using Microsoft.Extensions.Configuration;
54
using Microsoft.Extensions.DependencyInjection;

src/Stravaig.ShortCode/Encoder.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using System;
2-
using System.Security.Cryptography.X509Certificates;
32

43
namespace Stravaig.ShortCode
54
{

src/Stravaig.ShortCode/ShortCodeFactory.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public ShortCodeFactory(IShortCodeGenerator generator, IEncoder encoder, IOption
4141
private void WarnOnInconsistentOptions()
4242
{
4343
if (_options.Pattern.Length == 0 && _options.FixedLength.HasValue && _options.FixedLength.Value > _encoder.MaxLength())
44-
_logger.LogWarning("The Short Code generator will always produce codes with padding because the Fixed Length ({fixedLength}) option is greater than maximum length the encoder can generate ({encoderMaxLength}).",
44+
_logger.LogWarning("The Short Code generator will always produce codes with padding because the Fixed Length ({FixedLength}) option is greater than maximum length the encoder can generate ({EncoderMaxLength}).",
4545
_options.FixedLength.Value,
4646
_encoder.MaxLength());
4747
}

0 commit comments

Comments
 (0)