From 0a5278988447377ad25457e587c2a47412f060e9 Mon Sep 17 00:00:00 2001 From: Savorboard Date: Sun, 15 Dec 2019 00:01:45 +0800 Subject: [PATCH 1/4] Disable assembly generate --- src/DotNetCore.CAP.Dashboard/DotNetCore.CAP.Dashboard.csproj | 5 ++--- src/DotNetCore.CAP.Dashboard/Pages/LayoutPage.cshtml | 3 +-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/DotNetCore.CAP.Dashboard/DotNetCore.CAP.Dashboard.csproj b/src/DotNetCore.CAP.Dashboard/DotNetCore.CAP.Dashboard.csproj index d934d76..8e219ab 100644 --- a/src/DotNetCore.CAP.Dashboard/DotNetCore.CAP.Dashboard.csproj +++ b/src/DotNetCore.CAP.Dashboard/DotNetCore.CAP.Dashboard.csproj @@ -2,11 +2,10 @@ netstandard2.0 - false 1591 - + diff --git a/src/DotNetCore.CAP.Dashboard/Pages/LayoutPage.cshtml b/src/DotNetCore.CAP.Dashboard/Pages/LayoutPage.cshtml index e73ee90..6603ba4 100644 --- a/src/DotNetCore.CAP.Dashboard/Pages/LayoutPage.cshtml +++ b/src/DotNetCore.CAP.Dashboard/Pages/LayoutPage.cshtml @@ -1,7 +1,6 @@ @* Generator: Template TypeVisibility: Public GeneratePrettyNames: True *@ @using System @using System.Globalization -@using System.Reflection @using DotNetCore.CAP.Dashboard.Pages @using DotNetCore.CAP.Dashboard.Resources @inherits DotNetCore.CAP.Dashboard.RazorPage @@ -12,7 +11,7 @@ - @{ var version = GetType().GetTypeInfo().Assembly.GetName().Version; } + @{ var version = GetType().Assembly.GetName().Version; } From 549e81b726ba2d9f9b8d764a83e29476fd70c2e9 Mon Sep 17 00:00:00 2001 From: Savorboard Date: Sun, 15 Dec 2019 13:23:57 +0800 Subject: [PATCH 2/4] Changing target framework from netstandard 2.1 to 2.0 --- src/DotNetCore.CAP.MySql/DotNetCore.CAP.MySql.csproj | 6 +++--- .../DotNetCore.CAP.PostgreSql.csproj | 6 +++--- .../DotNetCore.CAP.SqlServer.csproj | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/DotNetCore.CAP.MySql/DotNetCore.CAP.MySql.csproj b/src/DotNetCore.CAP.MySql/DotNetCore.CAP.MySql.csproj index 8616c68..53978d8 100644 --- a/src/DotNetCore.CAP.MySql/DotNetCore.CAP.MySql.csproj +++ b/src/DotNetCore.CAP.MySql/DotNetCore.CAP.MySql.csproj @@ -1,7 +1,7 @@  - netstandard2.1 + netstandard2.0 DotNetCore.CAP.MySql $(PackageTags);MySQL @@ -13,8 +13,8 @@ - - + + diff --git a/src/DotNetCore.CAP.PostgreSql/DotNetCore.CAP.PostgreSql.csproj b/src/DotNetCore.CAP.PostgreSql/DotNetCore.CAP.PostgreSql.csproj index 84fdeeb..237db79 100644 --- a/src/DotNetCore.CAP.PostgreSql/DotNetCore.CAP.PostgreSql.csproj +++ b/src/DotNetCore.CAP.PostgreSql/DotNetCore.CAP.PostgreSql.csproj @@ -1,7 +1,7 @@  - netstandard2.1 + netstandard2.0 DotNetCore.CAP.PostgreSql $(PackageTags);PostgreSQL @@ -14,8 +14,8 @@ - - + + diff --git a/src/DotNetCore.CAP.SqlServer/DotNetCore.CAP.SqlServer.csproj b/src/DotNetCore.CAP.SqlServer/DotNetCore.CAP.SqlServer.csproj index 25257d7..b220951 100644 --- a/src/DotNetCore.CAP.SqlServer/DotNetCore.CAP.SqlServer.csproj +++ b/src/DotNetCore.CAP.SqlServer/DotNetCore.CAP.SqlServer.csproj @@ -1,7 +1,7 @@  - netstandard2.1 + netstandard2.0 DotNetCore.CAP.SqlServer $(PackageTags);SQL Server @@ -15,9 +15,9 @@ - - - + + + From 6b7a9759bb2bfd9d49fcb5d0cb7380e0fdc2188a Mon Sep 17 00:00:00 2001 From: Savorboard Date: Sun, 15 Dec 2019 14:09:09 +0800 Subject: [PATCH 3/4] Changing target framework from netstandard 2.1 to 2.0 --- .../DotNetCore.CAP.PostgreSql.csproj | 1 - .../IDataStorage.PostgreSql.cs | 10 +++++----- .../IMonitoringApi.PostgreSql.cs | 4 ++-- .../IStorageInitializer.PostgreSql.cs | 2 +- .../DotNetCore.CAP.SqlServer.csproj | 1 - src/DotNetCore.CAP.SqlServer/IDataStorage.SqlServer.cs | 10 +++++----- .../IMonitoringApi.SqlServer.cs | 4 ++-- .../IStorageInitializer.SqlServer.cs | 2 +- 8 files changed, 16 insertions(+), 18 deletions(-) diff --git a/src/DotNetCore.CAP.PostgreSql/DotNetCore.CAP.PostgreSql.csproj b/src/DotNetCore.CAP.PostgreSql/DotNetCore.CAP.PostgreSql.csproj index 237db79..51eb932 100644 --- a/src/DotNetCore.CAP.PostgreSql/DotNetCore.CAP.PostgreSql.csproj +++ b/src/DotNetCore.CAP.PostgreSql/DotNetCore.CAP.PostgreSql.csproj @@ -9,7 +9,6 @@ bin\$(Configuration)\netstandard2.0\DotNetCore.CAP.PostgreSql.xml 1701;1702;1705;CS1591 - 8 diff --git a/src/DotNetCore.CAP.PostgreSql/IDataStorage.PostgreSql.cs b/src/DotNetCore.CAP.PostgreSql/IDataStorage.PostgreSql.cs index bfb02d8..0c37114 100644 --- a/src/DotNetCore.CAP.PostgreSql/IDataStorage.PostgreSql.cs +++ b/src/DotNetCore.CAP.PostgreSql/IDataStorage.PostgreSql.cs @@ -42,7 +42,7 @@ namespace DotNetCore.CAP.PostgreSql { var sql = $"UPDATE {_pubName} SET \"Retries\"=@Retries,\"ExpiresAt\"=@ExpiresAt,\"StatusName\"=@StatusName WHERE \"Id\"=@Id"; - await using var connection = new NpgsqlConnection(_options.Value.ConnectionString); + using var connection = new NpgsqlConnection(_options.Value.ConnectionString); await connection.ExecuteAsync(sql, new { Id = long.Parse(message.DbId), @@ -56,7 +56,7 @@ namespace DotNetCore.CAP.PostgreSql { var sql = $"UPDATE {_recName} SET \"Retries\"=@Retries,\"ExpiresAt\"=@ExpiresAt,\"StatusName\"=@StatusName WHERE \"Id\"=@Id"; - await using var connection = new NpgsqlConnection(_options.Value.ConnectionString); + using var connection = new NpgsqlConnection(_options.Value.ConnectionString); await connection.ExecuteAsync(sql, new { Id = long.Parse(message.DbId), @@ -164,7 +164,7 @@ namespace DotNetCore.CAP.PostgreSql public async Task DeleteExpiresAsync(string table, DateTime timeout, int batchCount = 1000, CancellationToken token = default) { - await using var connection = new NpgsqlConnection(_options.Value.ConnectionString); + using var connection = new NpgsqlConnection(_options.Value.ConnectionString); return await connection.ExecuteAsync( $"DELETE FROM {table} WHERE \"ExpiresAt\" < @timeout AND \"Id\" IN (SELECT \"Id\" FROM {table} LIMIT @batchCount);", @@ -178,7 +178,7 @@ namespace DotNetCore.CAP.PostgreSql $"SELECT * FROM {_pubName} WHERE \"Retries\"<{_capOptions.Value.FailedRetryCount} AND \"Version\"='{_capOptions.Value.Version}' AND \"Added\"<'{fourMinAgo}' AND (\"StatusName\"='{StatusName.Failed}' OR \"StatusName\"='{StatusName.Scheduled}') LIMIT 200;"; var result = new List(); - await using var connection = new NpgsqlConnection(_options.Value.ConnectionString); + using var connection = new NpgsqlConnection(_options.Value.ConnectionString); var reader = await connection.ExecuteReaderAsync(sql); while (reader.Read()) { @@ -202,7 +202,7 @@ namespace DotNetCore.CAP.PostgreSql var result = new List(); - await using var connection = new NpgsqlConnection(_options.Value.ConnectionString); + using var connection = new NpgsqlConnection(_options.Value.ConnectionString); var reader = await connection.ExecuteReaderAsync(sql); while (reader.Read()) { diff --git a/src/DotNetCore.CAP.PostgreSql/IMonitoringApi.PostgreSql.cs b/src/DotNetCore.CAP.PostgreSql/IMonitoringApi.PostgreSql.cs index 56e5619..e41529c 100644 --- a/src/DotNetCore.CAP.PostgreSql/IMonitoringApi.PostgreSql.cs +++ b/src/DotNetCore.CAP.PostgreSql/IMonitoringApi.PostgreSql.cs @@ -34,7 +34,7 @@ namespace DotNetCore.CAP.PostgreSql var sql = $"SELECT * FROM {_pubName} WHERE \"Id\"={id} FOR UPDATE SKIP LOCKED"; - await using var connection = new NpgsqlConnection(_options.Value.ConnectionString); + using var connection = new NpgsqlConnection(_options.Value.ConnectionString); return await connection.QueryFirstOrDefaultAsync(sql); } @@ -42,7 +42,7 @@ namespace DotNetCore.CAP.PostgreSql { var sql = $"SELECT * FROM {_recName} WHERE \"Id\"={id} FOR UPDATE SKIP LOCKED"; - await using var connection = new NpgsqlConnection(_options.Value.ConnectionString); + using var connection = new NpgsqlConnection(_options.Value.ConnectionString); return await connection.QueryFirstOrDefaultAsync(sql); } diff --git a/src/DotNetCore.CAP.PostgreSql/IStorageInitializer.PostgreSql.cs b/src/DotNetCore.CAP.PostgreSql/IStorageInitializer.PostgreSql.cs index f8e8ba0..a9528c5 100644 --- a/src/DotNetCore.CAP.PostgreSql/IStorageInitializer.PostgreSql.cs +++ b/src/DotNetCore.CAP.PostgreSql/IStorageInitializer.PostgreSql.cs @@ -39,7 +39,7 @@ namespace DotNetCore.CAP.PostgreSql if (cancellationToken.IsCancellationRequested) return; var sql = CreateDbTablesScript(_options.Value.Schema); - await using (var connection = new NpgsqlConnection(_options.Value.ConnectionString)) + using (var connection = new NpgsqlConnection(_options.Value.ConnectionString)) { await connection.ExecuteAsync(sql); } diff --git a/src/DotNetCore.CAP.SqlServer/DotNetCore.CAP.SqlServer.csproj b/src/DotNetCore.CAP.SqlServer/DotNetCore.CAP.SqlServer.csproj index b220951..1503ffe 100644 --- a/src/DotNetCore.CAP.SqlServer/DotNetCore.CAP.SqlServer.csproj +++ b/src/DotNetCore.CAP.SqlServer/DotNetCore.CAP.SqlServer.csproj @@ -10,7 +10,6 @@ bin\$(Configuration)\netstandard2.0\DotNetCore.CAP.SqlServer.xml 1701;1702;1705;CS1591 - 8 diff --git a/src/DotNetCore.CAP.SqlServer/IDataStorage.SqlServer.cs b/src/DotNetCore.CAP.SqlServer/IDataStorage.SqlServer.cs index 7df2ea9..35290e4 100644 --- a/src/DotNetCore.CAP.SqlServer/IDataStorage.SqlServer.cs +++ b/src/DotNetCore.CAP.SqlServer/IDataStorage.SqlServer.cs @@ -42,7 +42,7 @@ namespace DotNetCore.CAP.SqlServer { var sql = $"UPDATE {_pubName} SET Retries=@Retries,ExpiresAt=@ExpiresAt,StatusName=@StatusName WHERE Id=@Id"; - await using var connection = new SqlConnection(_options.Value.ConnectionString); + using var connection = new SqlConnection(_options.Value.ConnectionString); await connection.ExecuteAsync(sql, new { Id = message.DbId, @@ -56,7 +56,7 @@ namespace DotNetCore.CAP.SqlServer { var sql = $"UPDATE {_recName} SET Retries=@Retries,ExpiresAt=@ExpiresAt,StatusName=@StatusName WHERE Id=@Id"; - await using var connection = new SqlConnection(_options.Value.ConnectionString); + using var connection = new SqlConnection(_options.Value.ConnectionString); await connection.ExecuteAsync(sql, new { Id = message.DbId, @@ -163,7 +163,7 @@ namespace DotNetCore.CAP.SqlServer public async Task DeleteExpiresAsync(string table, DateTime timeout, int batchCount = 1000, CancellationToken token = default) { - await using var connection = new SqlConnection(_options.Value.ConnectionString); + using var connection = new SqlConnection(_options.Value.ConnectionString); return await connection.ExecuteAsync( $"DELETE TOP (@batchCount) FROM {table} WITH (readpast) WHERE ExpiresAt < @timeout;", new { timeout, batchCount }); @@ -176,7 +176,7 @@ namespace DotNetCore.CAP.SqlServer $"AND Version='{_capOptions.Value.Version}' AND Added<'{fourMinAgo}' AND (StatusName = '{StatusName.Failed}' OR StatusName = '{StatusName.Scheduled}')"; var result = new List(); - await using var connection = new SqlConnection(_options.Value.ConnectionString); + using var connection = new SqlConnection(_options.Value.ConnectionString); var reader = await connection.ExecuteReaderAsync(sql); while (reader.Read()) { @@ -201,7 +201,7 @@ namespace DotNetCore.CAP.SqlServer var result = new List(); - await using var connection = new SqlConnection(_options.Value.ConnectionString); + var connection = new SqlConnection(_options.Value.ConnectionString); var reader = await connection.ExecuteReaderAsync(sql); while (reader.Read()) { diff --git a/src/DotNetCore.CAP.SqlServer/IMonitoringApi.SqlServer.cs b/src/DotNetCore.CAP.SqlServer/IMonitoringApi.SqlServer.cs index 9daf00d..16c7222 100644 --- a/src/DotNetCore.CAP.SqlServer/IMonitoringApi.SqlServer.cs +++ b/src/DotNetCore.CAP.SqlServer/IMonitoringApi.SqlServer.cs @@ -125,14 +125,14 @@ select count(Id) from {_recName} with (nolock) where StatusName = N'Failed';"; public async Task GetPublishedMessageAsync(long id) { var sql = $@"SELECT * FROM {_pubName} WITH (readpast) WHERE Id={id}"; - await using var connection = new SqlConnection(_options.ConnectionString); + using var connection = new SqlConnection(_options.ConnectionString); return await connection.QueryFirstOrDefaultAsync(sql); } public async Task GetReceivedMessageAsync(long id) { var sql = $@"SELECT * FROM {_recName} WITH (readpast) WHERE Id={id}"; - await using var connection = new SqlConnection(_options.ConnectionString); + using var connection = new SqlConnection(_options.ConnectionString); return await connection.QueryFirstOrDefaultAsync(sql); } diff --git a/src/DotNetCore.CAP.SqlServer/IStorageInitializer.SqlServer.cs b/src/DotNetCore.CAP.SqlServer/IStorageInitializer.SqlServer.cs index 8c0e7c7..7e48127 100644 --- a/src/DotNetCore.CAP.SqlServer/IStorageInitializer.SqlServer.cs +++ b/src/DotNetCore.CAP.SqlServer/IStorageInitializer.SqlServer.cs @@ -39,7 +39,7 @@ namespace DotNetCore.CAP.SqlServer if (cancellationToken.IsCancellationRequested) return; var sql = CreateDbTablesScript(_options.Value.Schema); - await using (var connection = new SqlConnection(_options.Value.ConnectionString)) + using (var connection = new SqlConnection(_options.Value.ConnectionString)) { await connection.ExecuteAsync(sql); } From 3fed62474b4ba3eba1948282348b27c42e1b1f4f Mon Sep 17 00:00:00 2001 From: Savorboard Date: Sun, 15 Dec 2019 14:09:49 +0800 Subject: [PATCH 4/4] Make jetbrains.annotations private --- src/Directory.Build.props | 2 ++ src/DotNetCore.CAP/DotNetCore.CAP.csproj | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 96e0e60..5cb2442 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -4,6 +4,7 @@ CAP + 8 ncc;savorboard https://github.com/dotnetcore/CAP git @@ -24,6 +25,7 @@ + \ No newline at end of file diff --git a/src/DotNetCore.CAP/DotNetCore.CAP.csproj b/src/DotNetCore.CAP/DotNetCore.CAP.csproj index 2bfc74f..965fd13 100644 --- a/src/DotNetCore.CAP/DotNetCore.CAP.csproj +++ b/src/DotNetCore.CAP/DotNetCore.CAP.csproj @@ -10,7 +10,6 @@ -