From 32b64ac1350f61c55779d1a359758c0cddacfaa3 Mon Sep 17 00:00:00 2001 From: Savorboard Date: Sat, 18 Aug 2018 12:03:07 +0800 Subject: [PATCH] reduce dependent nuget packages --- src/DotNetCore.CAP.MongoDB/MongoDBStorageConnection.cs | 6 +----- src/DotNetCore.CAP.MySql/IStorageConnection.MySql.cs | 6 +----- .../IStorageTransaction.PostgreSql.cs | 4 +--- src/DotNetCore.CAP/CAP.ServiceCollectionExtensions.cs | 1 - src/DotNetCore.CAP/DotNetCore.CAP.csproj | 3 --- src/DotNetCore.CAP/IStorageConnection.cs | 3 +-- src/DotNetCore.CAP/Processor/IProcessor.NeedRetry.cs | 5 ++--- 7 files changed, 6 insertions(+), 22 deletions(-) diff --git a/src/DotNetCore.CAP.MongoDB/MongoDBStorageConnection.cs b/src/DotNetCore.CAP.MongoDB/MongoDBStorageConnection.cs index 7b91026..4c9b07a 100644 --- a/src/DotNetCore.CAP.MongoDB/MongoDBStorageConnection.cs +++ b/src/DotNetCore.CAP.MongoDB/MongoDBStorageConnection.cs @@ -105,10 +105,6 @@ namespace DotNetCore.CAP.MongoDB var collection = _database.GetCollection(_options.ReceivedCollection); collection.InsertOne(message); - } - - public void Dispose() - { - } + } } } \ No newline at end of file diff --git a/src/DotNetCore.CAP.MySql/IStorageConnection.MySql.cs b/src/DotNetCore.CAP.MySql/IStorageConnection.MySql.cs index 97aadf6..0036ff2 100644 --- a/src/DotNetCore.CAP.MySql/IStorageConnection.MySql.cs +++ b/src/DotNetCore.CAP.MySql/IStorageConnection.MySql.cs @@ -109,10 +109,6 @@ VALUES(@Id,@Name,@Group,@Content,@Retries,@Added,@ExpiresAt,@StatusName);"; { return connection.Execute(sql) > 0; } - } - - public void Dispose() - { - } + } } } \ No newline at end of file diff --git a/src/DotNetCore.CAP.PostgreSql/IStorageTransaction.PostgreSql.cs b/src/DotNetCore.CAP.PostgreSql/IStorageTransaction.PostgreSql.cs index 64dd30c..28d75d8 100644 --- a/src/DotNetCore.CAP.PostgreSql/IStorageTransaction.PostgreSql.cs +++ b/src/DotNetCore.CAP.PostgreSql/IStorageTransaction.PostgreSql.cs @@ -47,9 +47,7 @@ namespace DotNetCore.CAP.PostgreSql } var sql = - $@"UPDATE ""{ - _schema - }"".""received"" SET ""Retries""=@Retries,""Content""= @Content,""ExpiresAt""=@ExpiresAt,""StatusName""=@StatusName WHERE ""Id""=@Id;"; + $@"UPDATE ""{_schema}"".""received"" SET ""Retries""=@Retries,""Content""= @Content,""ExpiresAt""=@ExpiresAt,""StatusName""=@StatusName WHERE ""Id""=@Id;"; _dbConnection.Execute(sql, message, _dbTransaction); } diff --git a/src/DotNetCore.CAP/CAP.ServiceCollectionExtensions.cs b/src/DotNetCore.CAP/CAP.ServiceCollectionExtensions.cs index f346693..9abf3f7 100644 --- a/src/DotNetCore.CAP/CAP.ServiceCollectionExtensions.cs +++ b/src/DotNetCore.CAP/CAP.ServiceCollectionExtensions.cs @@ -34,7 +34,6 @@ namespace Microsoft.Extensions.DependencyInjection } services.TryAddSingleton(); - services.Configure(setupAction); //Consumer service AddSubscribeServices(services); diff --git a/src/DotNetCore.CAP/DotNetCore.CAP.csproj b/src/DotNetCore.CAP/DotNetCore.CAP.csproj index 95556e8..0866cca 100644 --- a/src/DotNetCore.CAP/DotNetCore.CAP.csproj +++ b/src/DotNetCore.CAP/DotNetCore.CAP.csproj @@ -34,12 +34,9 @@ - - - diff --git a/src/DotNetCore.CAP/IStorageConnection.cs b/src/DotNetCore.CAP/IStorageConnection.cs index e305f58..ba9b413 100644 --- a/src/DotNetCore.CAP/IStorageConnection.cs +++ b/src/DotNetCore.CAP/IStorageConnection.cs @@ -1,7 +1,6 @@ // Copyright (c) .NET Core Community. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -using System; using System.Collections.Generic; using System.Threading.Tasks; using DotNetCore.CAP.Models; @@ -11,7 +10,7 @@ namespace DotNetCore.CAP /// /// Represents a connection to the storage. /// - public interface IStorageConnection : IDisposable + public interface IStorageConnection { //Sent messages diff --git a/src/DotNetCore.CAP/Processor/IProcessor.NeedRetry.cs b/src/DotNetCore.CAP/Processor/IProcessor.NeedRetry.cs index 36a6deb..e9b68dc 100644 --- a/src/DotNetCore.CAP/Processor/IProcessor.NeedRetry.cs +++ b/src/DotNetCore.CAP/Processor/IProcessor.NeedRetry.cs @@ -4,7 +4,6 @@ using System; using System.Threading.Tasks; using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Options; namespace DotNetCore.CAP.Processor { @@ -16,13 +15,13 @@ namespace DotNetCore.CAP.Processor private readonly TimeSpan _waitingInterval; public NeedRetryMessageProcessor( - IOptions options, + CapOptions options, ISubscriberExecutor subscriberExecutor, IPublishMessageSender publishMessageSender) { _subscriberExecutor = subscriberExecutor; _publishMessageSender = publishMessageSender; - _waitingInterval = TimeSpan.FromSeconds(options.Value.FailedRetryInterval); + _waitingInterval = TimeSpan.FromSeconds(options.FailedRetryInterval); } public async Task ProcessAsync(ProcessingContext context)