diff --git a/aspnetcore/fundamentals/primitives/change-tokens/sample/Extensions/ConfigurationMonitor.cs b/aspnetcore/fundamentals/primitives/change-tokens/sample/Extensions/ConfigurationMonitor.cs index a892852f5ec7..b7588a9e1529 100644 --- a/aspnetcore/fundamentals/primitives/change-tokens/sample/Extensions/ConfigurationMonitor.cs +++ b/aspnetcore/fundamentals/primitives/change-tokens/sample/Extensions/ConfigurationMonitor.cs @@ -26,10 +26,10 @@ public ConfigurationMonitor(IConfiguration config, IHostingEnvironment env) { _env = env; - ChangeToken.OnChange( + ChangeToken.OnChange( () => config.GetReloadToken(), - (state) => InvokeChanged(state), - "Not monitoring"); + InvokeChanged, + this); } public bool MonitoringEnabled { get; set; } = false; @@ -37,7 +37,7 @@ public ConfigurationMonitor(IConfiguration config, IHostingEnvironment env) #endregion #region snippet3 - private void InvokeChanged(string state) + private void InvokeChanged(IConfigurationMonitor state) { if (MonitoringEnabled) { @@ -48,13 +48,13 @@ private void InvokeChanged(string state) if (!_appsettingsHash.SequenceEqual(appsettingsHash) || !_appsettingsEnvHash.SequenceEqual(appsettingsEnvHash)) { - state = $"State updated at {DateTime.Now}"; - CurrentState = state; + string message = $"State updated at {DateTime.Now}"; + _appsettingsHash = appsettingsHash; _appsettingsEnvHash = appsettingsEnvHash; - WriteConsole($"Configuration changed (ConfigurationMonitor Class) {state}"); + WriteConsole($"Configuration changed (ConfigurationMonitor Class) {message}, state:{state.CurrentState}"); } } } diff --git a/aspnetcore/performance/caching/memory/sample/WebCache/WebCache.csproj b/aspnetcore/performance/caching/memory/sample/WebCache/WebCache.csproj new file mode 100644 index 000000000000..16c7f93109d2 --- /dev/null +++ b/aspnetcore/performance/caching/memory/sample/WebCache/WebCache.csproj @@ -0,0 +1,11 @@ + + + + netcoreapp2.1 + + + + + + + diff --git a/aspnetcore/performance/caching/memory/sample/WebCache/WebCache.xproj b/aspnetcore/performance/caching/memory/sample/WebCache/WebCache.xproj deleted file mode 100644 index 12e6b1dc6e5e..000000000000 --- a/aspnetcore/performance/caching/memory/sample/WebCache/WebCache.xproj +++ /dev/null @@ -1,25 +0,0 @@ - - - - 14.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - - 6085fe17-7a61-45a5-88e5-8ada483f2457 - WebCache - .\obj - .\bin\ - v4.5.2 - - - - 2.0 - - - - - - - diff --git a/aspnetcore/performance/caching/memory/sample/WebCache/project.json b/aspnetcore/performance/caching/memory/sample/WebCache/project.json deleted file mode 100644 index 52d02f12b16a..000000000000 --- a/aspnetcore/performance/caching/memory/sample/WebCache/project.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "dependencies": { - "Microsoft.AspNetCore.Mvc": "1.1.0", - "Microsoft.AspNetCore.Routing": "1.1.0", - "Microsoft.AspNetCore.Server.IISIntegration": "1.1.0", - "Microsoft.AspNetCore.Server.Kestrel": "1.1.0", - "Microsoft.Extensions.Caching.Memory": "1.1.0", - "Microsoft.NETCore.App": { - "version": "1.1.0", - "type": "platform" - } - }, - - "tools": { - "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.1.0-preview4-final" - }, - - "frameworks": { - "netcoreapp1.1": { - } - }, - - "buildOptions": { - "emitEntryPoint": true, - "preserveCompilationContext": true - }, - - "runtimeOptions": { - "configProperties": { - "System.GC.Server": true - } - }, - - "publishOptions": { - "include": [ - "wwwroot", - "web.config" - ] - }, - - "scripts": { - "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ] - } -}