Browse Source

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

master
Savorboard 5 years ago
parent
commit
2d92f5a4c1
13 changed files with 31 additions and 34 deletions
  1. +2
    -0
      src/Directory.Build.props
  2. +2
    -3
      src/DotNetCore.CAP.Dashboard/DotNetCore.CAP.Dashboard.csproj
  3. +1
    -2
      src/DotNetCore.CAP.Dashboard/Pages/LayoutPage.cshtml
  4. +3
    -3
      src/DotNetCore.CAP.MySql/DotNetCore.CAP.MySql.csproj
  5. +3
    -4
      src/DotNetCore.CAP.PostgreSql/DotNetCore.CAP.PostgreSql.csproj
  6. +5
    -5
      src/DotNetCore.CAP.PostgreSql/IDataStorage.PostgreSql.cs
  7. +2
    -2
      src/DotNetCore.CAP.PostgreSql/IMonitoringApi.PostgreSql.cs
  8. +1
    -1
      src/DotNetCore.CAP.PostgreSql/IStorageInitializer.PostgreSql.cs
  9. +4
    -5
      src/DotNetCore.CAP.SqlServer/DotNetCore.CAP.SqlServer.csproj
  10. +5
    -5
      src/DotNetCore.CAP.SqlServer/IDataStorage.SqlServer.cs
  11. +2
    -2
      src/DotNetCore.CAP.SqlServer/IMonitoringApi.SqlServer.cs
  12. +1
    -1
      src/DotNetCore.CAP.SqlServer/IStorageInitializer.SqlServer.cs
  13. +0
    -1
      src/DotNetCore.CAP/DotNetCore.CAP.csproj

+ 2
- 0
src/Directory.Build.props View File

@@ -4,6 +4,7 @@

<PropertyGroup Label="Package">
<Product>CAP</Product>
<LangVersion>8</LangVersion>
<Authors>ncc;savorboard</Authors>
<RepositoryUrl>https://github.com/dotnetcore/CAP</RepositoryUrl>
<RepositoryType>git</RepositoryType>
@@ -24,6 +25,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All"/>
<PackageReference Include="JetBrains.Annotations" Version="2019.1.3" PrivateAssets="All" />
</ItemGroup>

</Project>

+ 2
- 3
src/DotNetCore.CAP.Dashboard/DotNetCore.CAP.Dashboard.csproj View File

@@ -2,11 +2,10 @@

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<NoWarn>1591</NoWarn>
</PropertyGroup>

<PropertyGroup>
<!--<PropertyGroup>
<MSBuildCurrentFullPath>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin\MSBuild.exe</MSBuildCurrentFullPath>
<RazorProjectFile>Razor.build</RazorProjectFile>
<InnerTargets>GenerateRazorClasses;Build</InnerTargets>
@@ -15,7 +14,7 @@
<Target Name="GenerateRazorClasses">
<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)')" />
</Target>
</Target>-->

<ItemGroup>
<EmbeddedResource Include="Content\css\bootstrap.min.css" />


+ 1
- 2
src/DotNetCore.CAP.Dashboard/Pages/LayoutPage.cshtml View File

@@ -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 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta charset="utf-8">
<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}")">
</head>
<body>


+ 3
- 3
src/DotNetCore.CAP.MySql/DotNetCore.CAP.MySql.csproj View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<TargetFramework>netstandard2.0</TargetFramework>
<AssemblyName>DotNetCore.CAP.MySql</AssemblyName>
<PackageTags>$(PackageTags);MySQL</PackageTags>
</PropertyGroup>
@@ -13,8 +13,8 @@

<ItemGroup>
<PackageReference Include="Dapper" Version="2.0.30" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="3.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="3.1.0" />
<PackageReference Include="MySqlConnector" Version="0.60.3" />
</ItemGroup>



+ 3
- 4
src/DotNetCore.CAP.PostgreSql/DotNetCore.CAP.PostgreSql.csproj View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<TargetFramework>netstandard2.0</TargetFramework>
<AssemblyName>DotNetCore.CAP.PostgreSql</AssemblyName>
<PackageTags>$(PackageTags);PostgreSQL</PackageTags>
</PropertyGroup>
@@ -9,13 +9,12 @@
<PropertyGroup>
<DocumentationFile>bin\$(Configuration)\netstandard2.0\DotNetCore.CAP.PostgreSql.xml</DocumentationFile>
<NoWarn>1701;1702;1705;CS1591</NoWarn>
<LangVersion>8</LangVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Dapper" Version="2.0.30" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="3.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="3.1.0" />
<PackageReference Include="Npgsql" Version="4.1.1" />
</ItemGroup>



+ 5
- 5
src/DotNetCore.CAP.PostgreSql/IDataStorage.PostgreSql.cs View File

@@ -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<int> 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<MediumMessage>();
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<MediumMessage>();

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())
{


+ 2
- 2
src/DotNetCore.CAP.PostgreSql/IMonitoringApi.PostgreSql.cs View File

@@ -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<MediumMessage>(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<MediumMessage>(sql);
}



+ 1
- 1
src/DotNetCore.CAP.PostgreSql/IStorageInitializer.PostgreSql.cs View File

@@ -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);
}


+ 4
- 5
src/DotNetCore.CAP.SqlServer/DotNetCore.CAP.SqlServer.csproj View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<TargetFramework>netstandard2.0</TargetFramework>
<AssemblyName>DotNetCore.CAP.SqlServer</AssemblyName>
<PackageTags>$(PackageTags);SQL Server</PackageTags>

@@ -10,14 +10,13 @@
<PropertyGroup>
<DocumentationFile>bin\$(Configuration)\netstandard2.0\DotNetCore.CAP.SqlServer.xml</DocumentationFile>
<NoWarn>1701;1702;1705;CS1591</NoWarn>
<LangVersion>8</LangVersion>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Dapper" Version="2.0.30" />
<PackageReference Include="Microsoft.Data.SqlClient" Version="1.1.0-preview2.19309.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="3.0.0" />
<PackageReference Include="Microsoft.Data.SqlClient" Version="1.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="3.1.0" />
</ItemGroup>

<ItemGroup>


+ 5
- 5
src/DotNetCore.CAP.SqlServer/IDataStorage.SqlServer.cs View File

@@ -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<int> 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<MediumMessage>();
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<MediumMessage>();

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())
{


+ 2
- 2
src/DotNetCore.CAP.SqlServer/IMonitoringApi.SqlServer.cs View File

@@ -125,14 +125,14 @@ select count(Id) from {_recName} with (nolock) where StatusName = N'Failed';";
public async Task<MediumMessage> 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<MediumMessage>(sql);
}

public async Task<MediumMessage> 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<MediumMessage>(sql);
}



+ 1
- 1
src/DotNetCore.CAP.SqlServer/IStorageInitializer.SqlServer.cs View File

@@ -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);
}


+ 0
- 1
src/DotNetCore.CAP/DotNetCore.CAP.csproj View File

@@ -10,7 +10,6 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="JetBrains.Annotations" Version="2019.1.3" />
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="3.0.0" />
<PackageReference Include="Microsoft.Extensions.Options" Version="3.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />


Loading…
Cancel
Save