Commit 2d92f5a4 authored by Savorboard's avatar Savorboard

Merge branch 'master' of https://github.com/dotnetcore/CAP

parents 4464f14c 3fed6247
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
<PropertyGroup Label="Package"> <PropertyGroup Label="Package">
<Product>CAP</Product> <Product>CAP</Product>
<LangVersion>8</LangVersion>
<Authors>ncc;savorboard</Authors> <Authors>ncc;savorboard</Authors>
<RepositoryUrl>https://github.com/dotnetcore/CAP</RepositoryUrl> <RepositoryUrl>https://github.com/dotnetcore/CAP</RepositoryUrl>
<RepositoryType>git</RepositoryType> <RepositoryType>git</RepositoryType>
...@@ -24,6 +25,7 @@ ...@@ -24,6 +25,7 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All"/> <PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All"/>
<PackageReference Include="JetBrains.Annotations" Version="2019.1.3" PrivateAssets="All" />
</ItemGroup> </ItemGroup>
</Project> </Project>
\ No newline at end of file
...@@ -2,11 +2,10 @@ ...@@ -2,11 +2,10 @@
<PropertyGroup> <PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework> <TargetFramework>netstandard2.0</TargetFramework>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<NoWarn>1591</NoWarn> <NoWarn>1591</NoWarn>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <!--<PropertyGroup>
<MSBuildCurrentFullPath>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin\MSBuild.exe</MSBuildCurrentFullPath> <MSBuildCurrentFullPath>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin\MSBuild.exe</MSBuildCurrentFullPath>
<RazorProjectFile>Razor.build</RazorProjectFile> <RazorProjectFile>Razor.build</RazorProjectFile>
<InnerTargets>GenerateRazorClasses;Build</InnerTargets> <InnerTargets>GenerateRazorClasses;Build</InnerTargets>
...@@ -15,7 +14,7 @@ ...@@ -15,7 +14,7 @@
<Target Name="GenerateRazorClasses"> <Target Name="GenerateRazorClasses">
<Exec Command="&quot;$(MSBuildCurrentFullPath)&quot; $(RazorProjectFile) /v:quiet /nologo" Condition="Exists('$(MSBuildCurrentFullPath)')" /> <Exec Command="&quot;$(MSBuildCurrentFullPath)&quot; $(RazorProjectFile) /v:quiet /nologo" Condition="Exists('$(MSBuildCurrentFullPath)')" />
<Warning Text="Classes for Razor files (*.cshtml) weren't re-generated: couldn't find the '$(MSBuildCurrentFullPath)' file" Condition="!Exists('$(MSBuildCurrentFullPath)')" /> <Warning Text="Classes for Razor files (*.cshtml) weren't re-generated: couldn't find the '$(MSBuildCurrentFullPath)' file" Condition="!Exists('$(MSBuildCurrentFullPath)')" />
</Target> </Target>-->
<ItemGroup> <ItemGroup>
<EmbeddedResource Include="Content\css\bootstrap.min.css" /> <EmbeddedResource Include="Content\css\bootstrap.min.css" />
......
@* Generator: Template TypeVisibility: Public GeneratePrettyNames: True *@ @* Generator: Template TypeVisibility: Public GeneratePrettyNames: True *@
@using System @using System
@using System.Globalization @using System.Globalization
@using System.Reflection
@using DotNetCore.CAP.Dashboard.Pages @using DotNetCore.CAP.Dashboard.Pages
@using DotNetCore.CAP.Dashboard.Resources @using DotNetCore.CAP.Dashboard.Resources
@inherits DotNetCore.CAP.Dashboard.RazorPage @inherits DotNetCore.CAP.Dashboard.RazorPage
...@@ -12,7 +11,7 @@ ...@@ -12,7 +11,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
@{ var version = GetType().GetTypeInfo().Assembly.GetName().Version; } @{ var version = GetType().Assembly.GetName().Version; }
<link rel="stylesheet" href="@Url.To($"/css{version.Major}{version.Minor}{version.Build}")"> <link rel="stylesheet" href="@Url.To($"/css{version.Major}{version.Minor}{version.Build}")">
</head> </head>
<body> <body>
......
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework> <TargetFramework>netstandard2.0</TargetFramework>
<AssemblyName>DotNetCore.CAP.MySql</AssemblyName> <AssemblyName>DotNetCore.CAP.MySql</AssemblyName>
<PackageTags>$(PackageTags);MySQL</PackageTags> <PackageTags>$(PackageTags);MySQL</PackageTags>
</PropertyGroup> </PropertyGroup>
...@@ -13,8 +13,8 @@ ...@@ -13,8 +13,8 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="Dapper" Version="2.0.30" /> <PackageReference Include="Dapper" Version="2.0.30" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.0.0" /> <PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="3.0.0" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="3.1.0" />
<PackageReference Include="MySqlConnector" Version="0.60.3" /> <PackageReference Include="MySqlConnector" Version="0.60.3" />
</ItemGroup> </ItemGroup>
......
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework> <TargetFramework>netstandard2.0</TargetFramework>
<AssemblyName>DotNetCore.CAP.PostgreSql</AssemblyName> <AssemblyName>DotNetCore.CAP.PostgreSql</AssemblyName>
<PackageTags>$(PackageTags);PostgreSQL</PackageTags> <PackageTags>$(PackageTags);PostgreSQL</PackageTags>
</PropertyGroup> </PropertyGroup>
...@@ -9,13 +9,12 @@ ...@@ -9,13 +9,12 @@
<PropertyGroup> <PropertyGroup>
<DocumentationFile>bin\$(Configuration)\netstandard2.0\DotNetCore.CAP.PostgreSql.xml</DocumentationFile> <DocumentationFile>bin\$(Configuration)\netstandard2.0\DotNetCore.CAP.PostgreSql.xml</DocumentationFile>
<NoWarn>1701;1702;1705;CS1591</NoWarn> <NoWarn>1701;1702;1705;CS1591</NoWarn>
<LangVersion>8</LangVersion>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Dapper" Version="2.0.30" /> <PackageReference Include="Dapper" Version="2.0.30" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.0.0" /> <PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="3.0.0" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="3.1.0" />
<PackageReference Include="Npgsql" Version="4.1.1" /> <PackageReference Include="Npgsql" Version="4.1.1" />
</ItemGroup> </ItemGroup>
......
...@@ -42,7 +42,7 @@ namespace DotNetCore.CAP.PostgreSql ...@@ -42,7 +42,7 @@ namespace DotNetCore.CAP.PostgreSql
{ {
var sql = var sql =
$"UPDATE {_pubName} SET \"Retries\"=@Retries,\"ExpiresAt\"=@ExpiresAt,\"StatusName\"=@StatusName WHERE \"Id\"=@Id"; $"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 await connection.ExecuteAsync(sql, new
{ {
Id = long.Parse(message.DbId), Id = long.Parse(message.DbId),
...@@ -56,7 +56,7 @@ namespace DotNetCore.CAP.PostgreSql ...@@ -56,7 +56,7 @@ namespace DotNetCore.CAP.PostgreSql
{ {
var sql = var sql =
$"UPDATE {_recName} SET \"Retries\"=@Retries,\"ExpiresAt\"=@ExpiresAt,\"StatusName\"=@StatusName WHERE \"Id\"=@Id"; $"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 await connection.ExecuteAsync(sql, new
{ {
Id = long.Parse(message.DbId), Id = long.Parse(message.DbId),
...@@ -164,7 +164,7 @@ namespace DotNetCore.CAP.PostgreSql ...@@ -164,7 +164,7 @@ namespace DotNetCore.CAP.PostgreSql
public async Task<int> DeleteExpiresAsync(string table, DateTime timeout, int batchCount = 1000, public async Task<int> DeleteExpiresAsync(string table, DateTime timeout, int batchCount = 1000,
CancellationToken token = default) CancellationToken token = default)
{ {
await using var connection = new NpgsqlConnection(_options.Value.ConnectionString); using var connection = new NpgsqlConnection(_options.Value.ConnectionString);
return await connection.ExecuteAsync( return await connection.ExecuteAsync(
$"DELETE FROM {table} WHERE \"ExpiresAt\" < @timeout AND \"Id\" IN (SELECT \"Id\" FROM {table} LIMIT @batchCount);", $"DELETE FROM {table} WHERE \"ExpiresAt\" < @timeout AND \"Id\" IN (SELECT \"Id\" FROM {table} LIMIT @batchCount);",
...@@ -178,7 +178,7 @@ namespace DotNetCore.CAP.PostgreSql ...@@ -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;"; $"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<MediumMessage>(); var result = new List<MediumMessage>();
await using var connection = new NpgsqlConnection(_options.Value.ConnectionString); using var connection = new NpgsqlConnection(_options.Value.ConnectionString);
var reader = await connection.ExecuteReaderAsync(sql); var reader = await connection.ExecuteReaderAsync(sql);
while (reader.Read()) while (reader.Read())
{ {
...@@ -202,7 +202,7 @@ namespace DotNetCore.CAP.PostgreSql ...@@ -202,7 +202,7 @@ namespace DotNetCore.CAP.PostgreSql
var result = new List<MediumMessage>(); var result = new List<MediumMessage>();
await using var connection = new NpgsqlConnection(_options.Value.ConnectionString); using var connection = new NpgsqlConnection(_options.Value.ConnectionString);
var reader = await connection.ExecuteReaderAsync(sql); var reader = await connection.ExecuteReaderAsync(sql);
while (reader.Read()) while (reader.Read())
{ {
......
...@@ -34,7 +34,7 @@ namespace DotNetCore.CAP.PostgreSql ...@@ -34,7 +34,7 @@ namespace DotNetCore.CAP.PostgreSql
var sql = var sql =
$"SELECT * FROM {_pubName} WHERE \"Id\"={id} FOR UPDATE SKIP LOCKED"; $"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<MediumMessage>(sql); return await connection.QueryFirstOrDefaultAsync<MediumMessage>(sql);
} }
...@@ -42,7 +42,7 @@ namespace DotNetCore.CAP.PostgreSql ...@@ -42,7 +42,7 @@ namespace DotNetCore.CAP.PostgreSql
{ {
var sql = var sql =
$"SELECT * FROM {_recName} WHERE \"Id\"={id} FOR UPDATE SKIP LOCKED"; $"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<MediumMessage>(sql); return await connection.QueryFirstOrDefaultAsync<MediumMessage>(sql);
} }
......
...@@ -39,7 +39,7 @@ namespace DotNetCore.CAP.PostgreSql ...@@ -39,7 +39,7 @@ namespace DotNetCore.CAP.PostgreSql
if (cancellationToken.IsCancellationRequested) return; if (cancellationToken.IsCancellationRequested) return;
var sql = CreateDbTablesScript(_options.Value.Schema); 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); await connection.ExecuteAsync(sql);
} }
......
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework> <TargetFramework>netstandard2.0</TargetFramework>
<AssemblyName>DotNetCore.CAP.SqlServer</AssemblyName> <AssemblyName>DotNetCore.CAP.SqlServer</AssemblyName>
<PackageTags>$(PackageTags);SQL Server</PackageTags> <PackageTags>$(PackageTags);SQL Server</PackageTags>
...@@ -10,14 +10,13 @@ ...@@ -10,14 +10,13 @@
<PropertyGroup> <PropertyGroup>
<DocumentationFile>bin\$(Configuration)\netstandard2.0\DotNetCore.CAP.SqlServer.xml</DocumentationFile> <DocumentationFile>bin\$(Configuration)\netstandard2.0\DotNetCore.CAP.SqlServer.xml</DocumentationFile>
<NoWarn>1701;1702;1705;CS1591</NoWarn> <NoWarn>1701;1702;1705;CS1591</NoWarn>
<LangVersion>8</LangVersion>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Dapper" Version="2.0.30" /> <PackageReference Include="Dapper" Version="2.0.30" />
<PackageReference Include="Microsoft.Data.SqlClient" Version="1.1.0-preview2.19309.1" /> <PackageReference Include="Microsoft.Data.SqlClient" Version="1.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.0.0" /> <PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="3.0.0" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="3.1.0" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
......
...@@ -42,7 +42,7 @@ namespace DotNetCore.CAP.SqlServer ...@@ -42,7 +42,7 @@ namespace DotNetCore.CAP.SqlServer
{ {
var sql = var sql =
$"UPDATE {_pubName} SET Retries=@Retries,ExpiresAt=@ExpiresAt,StatusName=@StatusName WHERE Id=@Id"; $"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 await connection.ExecuteAsync(sql, new
{ {
Id = message.DbId, Id = message.DbId,
...@@ -56,7 +56,7 @@ namespace DotNetCore.CAP.SqlServer ...@@ -56,7 +56,7 @@ namespace DotNetCore.CAP.SqlServer
{ {
var sql = var sql =
$"UPDATE {_recName} SET Retries=@Retries,ExpiresAt=@ExpiresAt,StatusName=@StatusName WHERE Id=@Id"; $"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 await connection.ExecuteAsync(sql, new
{ {
Id = message.DbId, Id = message.DbId,
...@@ -163,7 +163,7 @@ namespace DotNetCore.CAP.SqlServer ...@@ -163,7 +163,7 @@ namespace DotNetCore.CAP.SqlServer
public async Task<int> DeleteExpiresAsync(string table, DateTime timeout, int batchCount = 1000, public async Task<int> DeleteExpiresAsync(string table, DateTime timeout, int batchCount = 1000,
CancellationToken token = default) CancellationToken token = default)
{ {
await using var connection = new SqlConnection(_options.Value.ConnectionString); using var connection = new SqlConnection(_options.Value.ConnectionString);
return await connection.ExecuteAsync( return await connection.ExecuteAsync(
$"DELETE TOP (@batchCount) FROM {table} WITH (readpast) WHERE ExpiresAt < @timeout;", $"DELETE TOP (@batchCount) FROM {table} WITH (readpast) WHERE ExpiresAt < @timeout;",
new { timeout, batchCount }); new { timeout, batchCount });
...@@ -176,7 +176,7 @@ namespace DotNetCore.CAP.SqlServer ...@@ -176,7 +176,7 @@ namespace DotNetCore.CAP.SqlServer
$"AND Version='{_capOptions.Value.Version}' AND Added<'{fourMinAgo}' AND (StatusName = '{StatusName.Failed}' OR StatusName = '{StatusName.Scheduled}')"; $"AND Version='{_capOptions.Value.Version}' AND Added<'{fourMinAgo}' AND (StatusName = '{StatusName.Failed}' OR StatusName = '{StatusName.Scheduled}')";
var result = new List<MediumMessage>(); var result = new List<MediumMessage>();
await using var connection = new SqlConnection(_options.Value.ConnectionString); using var connection = new SqlConnection(_options.Value.ConnectionString);
var reader = await connection.ExecuteReaderAsync(sql); var reader = await connection.ExecuteReaderAsync(sql);
while (reader.Read()) while (reader.Read())
{ {
...@@ -201,7 +201,7 @@ namespace DotNetCore.CAP.SqlServer ...@@ -201,7 +201,7 @@ namespace DotNetCore.CAP.SqlServer
var result = new List<MediumMessage>(); var result = new List<MediumMessage>();
await using var connection = new SqlConnection(_options.Value.ConnectionString); var connection = new SqlConnection(_options.Value.ConnectionString);
var reader = await connection.ExecuteReaderAsync(sql); var reader = await connection.ExecuteReaderAsync(sql);
while (reader.Read()) while (reader.Read())
{ {
......
...@@ -125,14 +125,14 @@ select count(Id) from {_recName} with (nolock) where StatusName = N'Failed';"; ...@@ -125,14 +125,14 @@ select count(Id) from {_recName} with (nolock) where StatusName = N'Failed';";
public async Task<MediumMessage> GetPublishedMessageAsync(long id) public async Task<MediumMessage> GetPublishedMessageAsync(long id)
{ {
var sql = $@"SELECT * FROM {_pubName} WITH (readpast) WHERE Id={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<MediumMessage>(sql); return await connection.QueryFirstOrDefaultAsync<MediumMessage>(sql);
} }
public async Task<MediumMessage> GetReceivedMessageAsync(long id) public async Task<MediumMessage> GetReceivedMessageAsync(long id)
{ {
var sql = $@"SELECT * FROM {_recName} WITH (readpast) WHERE Id={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<MediumMessage>(sql); return await connection.QueryFirstOrDefaultAsync<MediumMessage>(sql);
} }
......
...@@ -39,7 +39,7 @@ namespace DotNetCore.CAP.SqlServer ...@@ -39,7 +39,7 @@ namespace DotNetCore.CAP.SqlServer
if (cancellationToken.IsCancellationRequested) return; if (cancellationToken.IsCancellationRequested) return;
var sql = CreateDbTablesScript(_options.Value.Schema); 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); await connection.ExecuteAsync(sql);
} }
......
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="JetBrains.Annotations" Version="2019.1.3" />
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="3.0.0" /> <PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="3.0.0" />
<PackageReference Include="Microsoft.Extensions.Options" Version="3.0.0" /> <PackageReference Include="Microsoft.Extensions.Options" Version="3.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" /> <PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment