diff --git a/Configuration.sln b/Configuration.sln
index ff5fd66..c0e7579 100644
--- a/Configuration.sln
+++ b/Configuration.sln
@@ -1,7 +1,6 @@
-
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
-VisualStudioVersion = 15.0.26228.4
+VisualStudioVersion = 15.0.26228.10
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{F141E2D0-F9B8-4ADB-A19A-7B6FF4CA19A1}"
EndProject
@@ -61,6 +60,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Config
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Configuration.DockerSecrets.Test", "test\Microsoft.Extensions.Configuration.DockerSecrets.Test\Microsoft.Extensions.Configuration.DockerSecrets.Test.csproj", "{82A403ED-F827-4FED-BE38-7F87925A07E1}"
EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Configuration.ServiceFabric", "src\Microsoft.Extensions.Configuration.ServiceFabric\Microsoft.Extensions.Configuration.ServiceFabric.csproj", "{BD8CAF12-4D1F-42F6-90B7-7CA5390CB523}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -171,6 +172,10 @@ Global
{82A403ED-F827-4FED-BE38-7F87925A07E1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{82A403ED-F827-4FED-BE38-7F87925A07E1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{82A403ED-F827-4FED-BE38-7F87925A07E1}.Release|Any CPU.Build.0 = Release|Any CPU
+ {BD8CAF12-4D1F-42F6-90B7-7CA5390CB523}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {BD8CAF12-4D1F-42F6-90B7-7CA5390CB523}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {BD8CAF12-4D1F-42F6-90B7-7CA5390CB523}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {BD8CAF12-4D1F-42F6-90B7-7CA5390CB523}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -202,5 +207,6 @@ Global
{AC7FAD2A-5763-404D-B0FC-3CCA81A16B0A} = {B54371FF-B920-46C8-8D55-6B19DBB43EBF}
{69AB0230-D82E-438B-AFE5-85BFF414F1B8} = {F141E2D0-F9B8-4ADB-A19A-7B6FF4CA19A1}
{82A403ED-F827-4FED-BE38-7F87925A07E1} = {B54371FF-B920-46C8-8D55-6B19DBB43EBF}
+ {BD8CAF12-4D1F-42F6-90B7-7CA5390CB523} = {F141E2D0-F9B8-4ADB-A19A-7B6FF4CA19A1}
EndGlobalSection
EndGlobal
diff --git a/build/dependencies.props b/build/dependencies.props
index faaafcb..a3df2e2 100644
--- a/build/dependencies.props
+++ b/build/dependencies.props
@@ -9,6 +9,7 @@
4.7.1
1.6.1
2.0.0-*
+ 5.5.216
15.0.0
2.2.0
diff --git a/src/Microsoft.Extensions.Configuration.ServiceFabric/Microsoft.Extensions.Configuration.ServiceFabric.csproj b/src/Microsoft.Extensions.Configuration.ServiceFabric/Microsoft.Extensions.Configuration.ServiceFabric.csproj
new file mode 100644
index 0000000..1d0b4d4
--- /dev/null
+++ b/src/Microsoft.Extensions.Configuration.ServiceFabric/Microsoft.Extensions.Configuration.ServiceFabric.csproj
@@ -0,0 +1,20 @@
+
+
+
+
+
+ Service Fabric configuration provider implementation for Microsoft.Extensions.Configuration.
+ net45
+ win7-x64
+ true
+ configuration;servicefabric
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Microsoft.Extensions.Configuration.ServiceFabric/ServiceFabricConfigurationProvider.cs b/src/Microsoft.Extensions.Configuration.ServiceFabric/ServiceFabricConfigurationProvider.cs
new file mode 100644
index 0000000..57d2e2c
--- /dev/null
+++ b/src/Microsoft.Extensions.Configuration.ServiceFabric/ServiceFabricConfigurationProvider.cs
@@ -0,0 +1,47 @@
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+using System;
+using System.Fabric;
+
+namespace Microsoft.Extensions.Configuration.ServiceFabric
+{
+ ///
+ /// for Service Fabric.
+ ///
+ public class ServiceFabricConfigurationProvider : ConfigurationProvider
+ {
+ private readonly ServiceContext _serviceContext;
+ private readonly string _configurationPackageName;
+
+ ///
+ /// Initializes a new instance with Service Fabric context.
+ ///
+ /// The Service Fabric service context.
+ /// The name of the configuration package; defaults to "Config"
+ /// if not provided.
+ public ServiceFabricConfigurationProvider(ServiceContext serviceContext,
+ string configurationPackageName = null)
+ {
+ _serviceContext = serviceContext ?? throw new ArgumentNullException(nameof(serviceContext));
+ _configurationPackageName = configurationPackageName ?? "Config";
+ }
+
+ ///
+ /// Loads the Service Fabric settings.
+ ///
+ public override void Load()
+ {
+ var configurationPackage = _serviceContext.CodePackageActivationContext.GetConfigurationPackageObject(
+ _configurationPackageName);
+
+ foreach (var section in configurationPackage.Settings.Sections)
+ {
+ foreach (var parameter in section.Parameters)
+ {
+ Data[$"{section.Name}{ConfigurationPath.KeyDelimiter}{parameter.Name}"] = parameter.Value;
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Microsoft.Extensions.Configuration.ServiceFabric/ServiceFabricConfigurationSource.cs b/src/Microsoft.Extensions.Configuration.ServiceFabric/ServiceFabricConfigurationSource.cs
new file mode 100644
index 0000000..10ba2dd
--- /dev/null
+++ b/src/Microsoft.Extensions.Configuration.ServiceFabric/ServiceFabricConfigurationSource.cs
@@ -0,0 +1,28 @@
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+using System.Fabric;
+
+namespace Microsoft.Extensions.Configuration.ServiceFabric
+{
+ ///
+ /// Represents Service Fabric settings as an .
+ ///
+ public class ServiceFabricConfigurationSource : IConfigurationSource
+ {
+ ///
+ /// The Service Fabric service context.
+ ///
+ public ServiceContext ServiceContext { get; set; }
+
+ ///
+ /// Builds the for this source.
+ ///
+ /// The .
+ /// A
+ public IConfigurationProvider Build(IConfigurationBuilder builder)
+ {
+ return new ServiceFabricConfigurationProvider(ServiceContext);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Microsoft.Extensions.Configuration.ServiceFabric/ServiceFabricExtensions.cs b/src/Microsoft.Extensions.Configuration.ServiceFabric/ServiceFabricExtensions.cs
new file mode 100644
index 0000000..4e3c05c
--- /dev/null
+++ b/src/Microsoft.Extensions.Configuration.ServiceFabric/ServiceFabricExtensions.cs
@@ -0,0 +1,27 @@
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+using System.Fabric;
+
+namespace Microsoft.Extensions.Configuration.ServiceFabric
+{
+ ///
+ /// Extension methods for registering with
+ /// .
+ ///
+ public static class ServiceFabricExtensions
+ {
+ ///
+ /// Adds an that reads configuration values from Service Fabric settings.
+ ///
+ /// The to add to.
+ /// The Service Fabric service context
+ /// The .
+ public static IConfigurationBuilder AddServiceFabric(this IConfigurationBuilder configurationBuilder,
+ ServiceContext serviceContext)
+ {
+ configurationBuilder.Add(new ServiceFabricConfigurationSource { ServiceContext = serviceContext });
+ return configurationBuilder;
+ }
+ }
+}
\ No newline at end of file