Skip to content

Commit ca38c26

Browse files
committed
[#2] [add] impl
[up] Grpc.Core to 2.46.3 [edit] version/changelog
1 parent 28551f1 commit ca38c26

File tree

3 files changed

+31
-10
lines changed

3 files changed

+31
-10
lines changed

src/Etcd.Microsoft.Extensions.Configuration/CHANGELOG.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,23 @@
11
# Changelog
22

3+
## [1.0.2] - 2022-05-29
4+
5+
### Fixed
6+
7+
- IConfigurationSection.GetChildren returns empty result (#2)
8+
9+
### Dependencies
10+
11+
- Grpc.Core bump to 2.46.3 for .NET 4.6.2 target
12+
13+
### Added
14+
15+
- .NET 6 explicit support
16+
17+
### Removed
18+
19+
- .NET 5 incorrect target
20+
321
## [1.0.1] - 2021-11-15
422

523
### Fixed

src/Etcd.Microsoft.Extensions.Configuration/Etcd.Microsoft.Extensions.Configuration.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
99
<GenerateDocumentationFile>true</GenerateDocumentationFile>
1010

11-
<Version>1.0.1</Version>
11+
<Version>1.0.2</Version>
1212

1313
<Description>Etcd based configuration provider for Microsoft.Extensions.Configuration</Description>
1414
<Authors>Simplify community</Authors>
@@ -27,7 +27,7 @@
2727
<PackageReference Include="Microsoft.Extensions.Configuration" Version="5.0.0" />
2828
</ItemGroup>
2929
<ItemGroup Condition=" '$(TargetFramework)' == 'net462' ">
30-
<PackageReference Include="Grpc.Core" Version="2.41.0" />
30+
<PackageReference Include="Grpc.Core" Version="2.46.3" />
3131
</ItemGroup>
3232
<ItemGroup>
3333
<None Include="..\..\images\icon.png" Pack="true" Visible="false" PackagePath="" />

src/Etcd.Microsoft.Extensions.Configuration/EtcdConfigurationProvider.cs

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
using System;
22
using System.Collections.Generic;
3+
using Microsoft.Extensions.Configuration;
34
using Etcd.Microsoft.Extensions.Configuration.Client;
45
using Etcd.Microsoft.Extensions.Configuration.Watch;
5-
using Microsoft.Extensions.Configuration;
66

77
namespace Etcd.Microsoft.Extensions.Configuration;
88

@@ -27,9 +27,6 @@ public EtcdConfigurationProvider(IEtcdKeyValueClient client, string? keyPrefix =
2727
_client = client;
2828
_keyPrefix = keyPrefix;
2929

30-
if (_keyPrefix != null)
31-
_keyPrefix += ":";
32-
3330
_client.WatchCallback += OnWatchCallback;
3431
}
3532

@@ -46,13 +43,21 @@ public EtcdConfigurationProvider(IEtcdKeyValueClient client, string? keyPrefix =
4643
/// <returns>
4744
/// True if key has a value, false otherwise.
4845
/// </returns>
49-
public override bool TryGet(string key, out string value) => base.TryGet(_keyPrefix + key, out value);
46+
public override bool TryGet(string key, out string value) =>
47+
base.TryGet(_keyPrefix == null
48+
? key
49+
: _keyPrefix + ":" + key
50+
, out value);
5051

5152
/// <summary>Returns the list of keys that this provider has.</summary>
5253
/// <param name="earlierKeys">The earlier keys that other providers contain.</param>
5354
/// <param name="parentPath">The path for the parent IConfiguration.</param>
5455
/// <returns>The list of keys for this provider.</returns>
55-
public override IEnumerable<string> GetChildKeys(IEnumerable<string> earlierKeys, string parentPath) => base.GetChildKeys(earlierKeys, _keyPrefix + parentPath);
56+
public override IEnumerable<string> GetChildKeys(IEnumerable<string> earlierKeys, string parentPath) =>
57+
base.GetChildKeys(earlierKeys,
58+
_keyPrefix != null
59+
? _keyPrefix + parentPath
60+
: parentPath);
5661

5762
/// <summary>
5863
/// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
@@ -73,9 +78,7 @@ private void OnWatchCallback(IEnumerable<WatchEvent> events)
7378
Data.Add(item.Key, item.Value);
7479
}
7580
else
76-
{
7781
Data.Remove(item.Key);
78-
}
7982
}
8083
}
8184
}

0 commit comments

Comments
 (0)