Skip to content
This repository has been archived by the owner on Dec 12, 2020. It is now read-only.

Commit

Permalink
Merge pull request #72 from Azure/october-integration
Browse files Browse the repository at this point in the history
October Integration Release
  • Loading branch information
jamesweb-ms committed Nov 9, 2015
2 parents a89f84f + 2572655 commit e702eb4
Show file tree
Hide file tree
Showing 288 changed files with 11,677 additions and 8,647 deletions.
17 changes: 9 additions & 8 deletions Common/Common.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
<CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
<CodeAnalysisRuleSet>..\DeviceAdministration\DeviceAdministration.ruleset</CodeAnalysisRuleSet>
<RunCodeAnalysis>true</RunCodeAnalysis>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
<CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
Expand Down Expand Up @@ -111,13 +113,14 @@
<Compile Include="Helpers\AzureRetryHelper.cs" />
<Compile Include="Helpers\AzureTableStorageHelper.cs" />
<Compile Include="Helpers\BlobStorageHelper.cs" />
<Compile Include="Helpers\DocDbQueryResult.cs" />
<Compile Include="Utility\DocDbQueryResult.cs" />
<Compile Include="Helpers\DynamicValuesHelper.cs" />
<Compile Include="Helpers\FunctionalHelper.cs" />
<Compile Include="Helpers\DocDbRestHelper.cs" />
<Compile Include="Helpers\IDocDbRestHelper.cs" />
<Compile Include="Utility\DocDbResourceType.cs" />
<Compile Include="Utility\DocDbResourceTypeHelper.cs" />
<Compile Include="Utility\DocDbRestUtility.cs" />
<Compile Include="Utility\IDocDbRestUtility.cs" />
<Compile Include="Helpers\ParsingHelper.cs" />
<Compile Include="Helpers\PropertySetterHelper.cs" />
<Compile Include="Helpers\ReflectionHelper.cs" />
<Compile Include="Models\Commands\Command.cs" />
<Compile Include="Models\Commands\DeviceCommandConstants.cs" />
Expand All @@ -140,20 +143,18 @@
<SubType>Designer</SubType>
</None>
<None Include="Deployment\Application.json" />
<None Include="Deployment\AzureDeployment.json" />
<None Include="Deployment\ConfigurationTemplate.config">
<SubType>Designer</SubType>
</None>
<None Include="Deployment\DeploymentLib.ps1" />
<None Include="Deployment\DeviceInfoFilterJob.json" />
<None Include="Deployment\PrepareIoTSample.ps1" />
<None Include="Deployment\PublishIoTSample.ps1" />
<None Include="Deployment\LocalMonitoring.json" />
<None Include="Deployment\RemoteMonitoring.json" />
<None Include="Deployment\TelemetryToBlobJob.json" />
<None Include="packages.config">
<SubType>Designer</SubType>
</None>
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
Expand Down
40 changes: 36 additions & 4 deletions Common/Configurations/ConfigurationProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@

namespace Microsoft.Azure.Devices.Applications.RemoteMonitoring.Common.Configurations
{
public class ConfigurationProvider : IConfigurationProvider
public class ConfigurationProvider : IConfigurationProvider, IDisposable
{
readonly Dictionary<string, string> configuration = new Dictionary<string, string>();
EnvironmentDescription environment = null;
const string ConfigToken = "config:";
bool _disposed = false;

public string GetConfigurationSettingValue(string configurationSettingName)
{
Expand Down Expand Up @@ -42,15 +43,17 @@ public string GetConfigurationSettingValueOrDefault(string configurationSettingN
{
configValue = ConfigurationManager.AppSettings[configurationSettingName];
isEmulated = Environment.CommandLine.Contains("iisexpress.exe") ||
Environment.CommandLine.Contains("DeviceAdministration.WebJob.vshost.exe");
Environment.CommandLine.Contains("WebJob.vshost.exe");
}
if (isEmulated && configValue.StartsWith(ConfigToken, StringComparison.OrdinalIgnoreCase))
if (isEmulated && (configValue != null && configValue.StartsWith(ConfigToken, StringComparison.OrdinalIgnoreCase)))
{
if (environment == null)
{
LoadEnvironmentConfig();
}
configValue = environment.GetSetting(configValue.Substring(configValue.IndexOf(ConfigToken) + ConfigToken.Length));

configValue =
environment.GetSetting(configValue.Substring(configValue.IndexOf(ConfigToken, StringComparison.Ordinal) + ConfigToken.Length));
}
try
{
Expand Down Expand Up @@ -108,5 +111,34 @@ void LoadEnvironmentConfig()

throw new ArgumentException("Unable to locate local.config.user file. Make sure you have run 'build.cmd local'.");
}

public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}

protected virtual void Dispose(bool disposing)
{
if (_disposed)
{
return;
}

if (disposing)
{
if (environment != null)
{
environment.Dispose();
}
}

_disposed = true;
}

~ConfigurationProvider()
{
Dispose(false);
}
}
}
Loading

0 comments on commit e702eb4

Please sign in to comment.