From f3c5b3a0abd8514c9d3117f73138172e0d890ff4 Mon Sep 17 00:00:00 2001 From: Menno van Lavieren Date: Mon, 14 Aug 2017 13:58:01 +0200 Subject: [PATCH] SqlFlow Repository interface aangepast --- Tapeti.Flow.SQL/ConfigExtensions.cs | 2 +- Tapeti.Flow.SQL/SqlConnectionFlowRepository.cs | 8 ++++---- Tapeti.Flow/ConfigExtensions.cs | 2 +- Tapeti.Flow/Default/FlowStore.cs | 6 +++--- Tapeti.Flow/Default/NonPersistentFlowRepository.cs | 8 ++++---- Tapeti.Flow/FlowMiddleware.cs | 6 +++--- Tapeti.Flow/IFlowRepository.cs | 8 ++++---- 7 files changed, 20 insertions(+), 20 deletions(-) diff --git a/Tapeti.Flow.SQL/ConfigExtensions.cs b/Tapeti.Flow.SQL/ConfigExtensions.cs index 70b1aff..c5e660d 100644 --- a/Tapeti.Flow.SQL/ConfigExtensions.cs +++ b/Tapeti.Flow.SQL/ConfigExtensions.cs @@ -30,7 +30,7 @@ namespace Tapeti.Flow.SQL public void RegisterDefaults(IDependencyContainer container) { - container.RegisterDefault>(() => new SqlConnectionFlowRepository(connectionString, serviceId, schema)); + container.RegisterDefault(() => new SqlConnectionFlowRepository(connectionString, serviceId, schema)); } diff --git a/Tapeti.Flow.SQL/SqlConnectionFlowRepository.cs b/Tapeti.Flow.SQL/SqlConnectionFlowRepository.cs index 4af9d05..78e47a7 100644 --- a/Tapeti.Flow.SQL/SqlConnectionFlowRepository.cs +++ b/Tapeti.Flow.SQL/SqlConnectionFlowRepository.cs @@ -24,7 +24,7 @@ namespace Tapeti.Flow.SQL ); go; */ - public class SqlConnectionFlowRepository : IFlowRepository + public class SqlConnectionFlowRepository : IFlowRepository { private readonly string connectionString; private readonly int serviceId; @@ -39,7 +39,7 @@ namespace Tapeti.Flow.SQL } - public async Task>> GetStates() + public async Task>> GetStates() { using (var connection = await GetConnection()) { @@ -69,14 +69,14 @@ namespace Tapeti.Flow.SQL } - public Task CreateState(Guid flowID, T state, DateTime timestamp) + public Task CreateState(Guid flowID, T state, DateTime timestamp) { var stateJason = JsonConvert.SerializeObject(state); throw new NotImplementedException(); } - public Task UpdateState(Guid flowID, T state) + public Task UpdateState(Guid flowID, T state) { throw new NotImplementedException(); } diff --git a/Tapeti.Flow/ConfigExtensions.cs b/Tapeti.Flow/ConfigExtensions.cs index 843333e..127a0c2 100644 --- a/Tapeti.Flow/ConfigExtensions.cs +++ b/Tapeti.Flow/ConfigExtensions.cs @@ -2,7 +2,7 @@ { public static class ConfigExtensions { - public static TapetiConfig WithFlow(this TapetiConfig config, IFlowRepository flowRepository = null) + public static TapetiConfig WithFlow(this TapetiConfig config, IFlowRepository flowRepository = null) { config.Use(new FlowMiddleware(flowRepository)); return config; diff --git a/Tapeti.Flow/Default/FlowStore.cs b/Tapeti.Flow/Default/FlowStore.cs index 8bb1061..b4e63ba 100644 --- a/Tapeti.Flow/Default/FlowStore.cs +++ b/Tapeti.Flow/Default/FlowStore.cs @@ -13,10 +13,10 @@ namespace Tapeti.Flow.Default private static readonly ConcurrentDictionary FlowStates = new ConcurrentDictionary(); private static readonly ConcurrentDictionary ContinuationLookup = new ConcurrentDictionary(); - private readonly IFlowRepository repository; + private readonly IFlowRepository repository; - public FlowStore(IFlowRepository repository) + public FlowStore(IFlowRepository repository) { this.repository = repository; } @@ -27,7 +27,7 @@ namespace Tapeti.Flow.Default FlowStates.Clear(); ContinuationLookup.Clear(); - foreach (var flowStateRecord in await repository.GetStates()) + foreach (var flowStateRecord in await repository.GetStates()) { FlowStates.TryAdd(flowStateRecord.Key, flowStateRecord.Value); diff --git a/Tapeti.Flow/Default/NonPersistentFlowRepository.cs b/Tapeti.Flow/Default/NonPersistentFlowRepository.cs index dee4e78..00ec009 100644 --- a/Tapeti.Flow/Default/NonPersistentFlowRepository.cs +++ b/Tapeti.Flow/Default/NonPersistentFlowRepository.cs @@ -5,19 +5,19 @@ using System.Threading.Tasks; namespace Tapeti.Flow.Default { - public class NonPersistentFlowRepository : IFlowRepository + public class NonPersistentFlowRepository : IFlowRepository { - Task>> IFlowRepository.GetStates() + Task>> IFlowRepository.GetStates() { return Task.FromResult(new List>()); } - public Task CreateState(Guid flowID, T state, DateTime timestamp) + public Task CreateState(Guid flowID, T state, DateTime timestamp) { return Task.CompletedTask; } - public Task UpdateState(Guid flowID, T state) + public Task UpdateState(Guid flowID, T state) { return Task.CompletedTask; } diff --git a/Tapeti.Flow/FlowMiddleware.cs b/Tapeti.Flow/FlowMiddleware.cs index cba399d..bef12a5 100644 --- a/Tapeti.Flow/FlowMiddleware.cs +++ b/Tapeti.Flow/FlowMiddleware.cs @@ -6,9 +6,9 @@ namespace Tapeti.Flow { public class FlowMiddleware : ITapetiExtension { - private IFlowRepository flowRepository; + private IFlowRepository flowRepository; - public FlowMiddleware(IFlowRepository flowRepository) + public FlowMiddleware(IFlowRepository flowRepository) { this.flowRepository = flowRepository; } @@ -18,7 +18,7 @@ namespace Tapeti.Flow container.RegisterDefault(); container.RegisterDefault(); container.RegisterDefault(); - container.RegisterDefault>(() => flowRepository ?? new NonPersistentFlowRepository()); + container.RegisterDefault(() => flowRepository ?? new NonPersistentFlowRepository()); container.RegisterDefault(); } diff --git a/Tapeti.Flow/IFlowRepository.cs b/Tapeti.Flow/IFlowRepository.cs index ce026d9..0f5dbb4 100644 --- a/Tapeti.Flow/IFlowRepository.cs +++ b/Tapeti.Flow/IFlowRepository.cs @@ -5,11 +5,11 @@ using System.Threading.Tasks; namespace Tapeti.Flow { - public interface IFlowRepository + public interface IFlowRepository { - Task>> GetStates(); - Task CreateState(Guid flowID, T state, DateTime timestamp); - Task UpdateState(Guid flowID, T state); + Task>> GetStates(); + Task CreateState(Guid flowID, T state, DateTime timestamp); + Task UpdateState(Guid flowID, T state); Task DeleteState(Guid flowID); }