From b1f1d69c2e221c0e2f202841713eee3202b81ce6 Mon Sep 17 00:00:00 2001 From: "Steven T. Cramer" Date: Wed, 24 Jul 2024 19:13:11 +0700 Subject: [PATCH 1/3] Rename BaseCacheableState to TimeWarpCacheableState --- Directory.Build.props | 2 +- .../State/{ICacheableState.cs => ITimeWarpCacheableState.cs} | 2 +- .../{BaseCacheableState.cs => TimeWarpCacheableState.cs} | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) rename Source/TimeWarp.State.Plus/State/{ICacheableState.cs => ITimeWarpCacheableState.cs} (76%) rename Source/TimeWarp.State.Plus/State/{BaseCacheableState.cs => TimeWarpCacheableState.cs} (93%) diff --git a/Directory.Build.props b/Directory.Build.props index d3815c3e2..3225a2103 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,7 +1,7 @@ - 11.0.0-beta.65+8.0.303 + 11.0.0-beta.66+8.0.303 Steven T. Cramer TimeWarp State $(TimeWarpStateVersion) diff --git a/Source/TimeWarp.State.Plus/State/ICacheableState.cs b/Source/TimeWarp.State.Plus/State/ITimeWarpCacheableState.cs similarity index 76% rename from Source/TimeWarp.State.Plus/State/ICacheableState.cs rename to Source/TimeWarp.State.Plus/State/ITimeWarpCacheableState.cs index 27913e09f..a2b4155f7 100644 --- a/Source/TimeWarp.State.Plus/State/ICacheableState.cs +++ b/Source/TimeWarp.State.Plus/State/ITimeWarpCacheableState.cs @@ -1,6 +1,6 @@ namespace TimeWarp.State.Plus.State; -public interface ICacheableState +public interface ITimeWarpCacheableState { string? CacheKey { get; } DateTime? TimeStamp { get; } diff --git a/Source/TimeWarp.State.Plus/State/BaseCacheableState.cs b/Source/TimeWarp.State.Plus/State/TimeWarpCacheableState.cs similarity index 93% rename from Source/TimeWarp.State.Plus/State/BaseCacheableState.cs rename to Source/TimeWarp.State.Plus/State/TimeWarpCacheableState.cs index 7be7557fd..563d78814 100644 --- a/Source/TimeWarp.State.Plus/State/BaseCacheableState.cs +++ b/Source/TimeWarp.State.Plus/State/TimeWarpCacheableState.cs @@ -1,12 +1,12 @@ namespace TimeWarp.State.Plus.State; -public abstract class BaseCacheableState : State, ICacheableState +public abstract class TimeWarpCacheableState : State, ITimeWarpCacheableState { public string? CacheKey { get; private set; } public DateTime? TimeStamp { get; private set; } public TimeSpan CacheDuration { get; private set; } - protected BaseCacheableState(TimeSpan cacheDuration) + protected TimeWarpCacheableState(TimeSpan cacheDuration) { CacheDuration = cacheDuration; } From aa81e4b46a24212ee54d67a673be4cfdc5d299ef Mon Sep 17 00:00:00 2001 From: "Steven T. Cramer" Date: Wed, 24 Jul 2024 20:26:45 +0700 Subject: [PATCH 2/3] remove CacheDuration from constructor and make setter protected. --- .../TimeWarp.State.Plus/State/TimeWarpCacheableState.cs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/Source/TimeWarp.State.Plus/State/TimeWarpCacheableState.cs b/Source/TimeWarp.State.Plus/State/TimeWarpCacheableState.cs index 563d78814..acbe58359 100644 --- a/Source/TimeWarp.State.Plus/State/TimeWarpCacheableState.cs +++ b/Source/TimeWarp.State.Plus/State/TimeWarpCacheableState.cs @@ -1,15 +1,11 @@ namespace TimeWarp.State.Plus.State; public abstract class TimeWarpCacheableState : State, ITimeWarpCacheableState +where TState : IState { public string? CacheKey { get; private set; } public DateTime? TimeStamp { get; private set; } - public TimeSpan CacheDuration { get; private set; } - - protected TimeWarpCacheableState(TimeSpan cacheDuration) - { - CacheDuration = cacheDuration; - } + public TimeSpan CacheDuration { get; protected set; } /// /// Checks if the cache is valid based on the current cache key and timestamp From 38777c47b0e34268e253d7fd90d66592c0b81c0f Mon Sep 17 00:00:00 2001 From: "Steven T. Cramer" Date: Wed, 24 Jul 2024 20:40:46 +0700 Subject: [PATCH 3/3] Fix classname in test --- .../Features/CacheableWeather/CacheableWeatherState.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Tests/Test.App/Test.App.Client/Features/CacheableWeather/CacheableWeatherState.cs b/Tests/Test.App/Test.App.Client/Features/CacheableWeather/CacheableWeatherState.cs index 329c63eb3..a95cb21bb 100644 --- a/Tests/Test.App/Test.App.Client/Features/CacheableWeather/CacheableWeatherState.cs +++ b/Tests/Test.App/Test.App.Client/Features/CacheableWeather/CacheableWeatherState.cs @@ -3,13 +3,16 @@ namespace Test.App.Client.Features.WeatherForecast; using TimeWarp.State.Plus.State; using static Contracts.Features.WeatherForecast.GetWeatherForecasts; -internal partial class CacheableWeatherState: BaseCacheableState +internal partial class CacheableWeatherState: TimeWarpCacheableState { private Response? WeatherForecastList; public IReadOnlyList? WeatherForecasts => WeatherForecastList?.AsReadOnly(); - public CacheableWeatherState():base(TimeSpan.FromSeconds(10)) {} // Set this to short duration for testing + public CacheableWeatherState() + { + CacheDuration = TimeSpan.FromSeconds(10); + } // Set this to short duration for testing /// public override void Initialize()