Browse Source

Fix compilation errors after the upgrade

master
Savorboard 6 years ago
parent
commit
7fc1bb5908
4 changed files with 19 additions and 11 deletions
  1. +4
    -4
      src/DotNetCore.CAP.MySql/MySqlMonitoringApi.cs
  2. +3
    -3
      src/DotNetCore.CAP.PostgreSql/PostgreSqlMonitoringApi.cs
  3. +4
    -4
      src/DotNetCore.CAP.SqlServer/SqlServerMonitoringApi.cs
  4. +8
    -0
      src/DotNetCore.CAP/Dashboard/TimelineCounter.cs

+ 4
- 4
src/DotNetCore.CAP.MySql/MySqlMonitoringApi.cs View File

@@ -126,7 +126,7 @@ select count(Id) from `{0}.received` where StatusName = N'Failed';", _prefix);
{
var sqlQuery = $"select count(Id) from `{_prefix}.{tableName}` where StatusName = @state";

var count = connection.ExecuteScalar<int>(sqlQuery, new {state = statusName});
var count = connection.ExecuteScalar<int>(sqlQuery, new { state = statusName });
return count;
}

@@ -167,10 +167,10 @@ select aggr.* from (
group by date_format(`Added`,'%Y-%m-%d-%H')
) aggr where `Key` in @keys;";

var valuesMap = connection.Query(
var valuesMap = connection.Query<TimelineCounter>(
sqlQuery,
new {keys = keyMaps.Keys, statusName})
.ToDictionary(x => (string) x.Key, x => (int) x.Count);
new { keys = keyMaps.Keys, statusName })
.ToDictionary(x => x.Key, x => x.Count);

foreach (var key in keyMaps.Keys)
{


+ 3
- 3
src/DotNetCore.CAP.PostgreSql/PostgreSqlMonitoringApi.cs View File

@@ -128,7 +128,7 @@ select count(""Id"") from ""{0}"".""received"" where ""StatusName"" = N'Failed'
var sqlQuery =
$"select count(\"Id\") from \"{_options.Schema}\".\"{tableName}\" where Lower(\"StatusName\") = Lower(@state)";

var count = connection.ExecuteScalar<int>(sqlQuery, new {state = statusName});
var count = connection.ExecuteScalar<int>(sqlQuery, new { state = statusName });
return count;
}

@@ -170,9 +170,9 @@ with aggr as (
)
select ""Key"",""Count"" from aggr where ""Key""= Any(@keys);";

var valuesMap = connection.Query(sqlQuery, new {keys = keyMaps.Keys.ToList(), statusName})
var valuesMap = connection.Query<TimelineCounter>(sqlQuery, new { keys = keyMaps.Keys.ToList(), statusName })
.ToList()
.ToDictionary(x => (string) x.Key, x => (int) x.Count);
.ToDictionary(x => x.Key, x => x.Count);

foreach (var key in keyMaps.Keys)
{


+ 4
- 4
src/DotNetCore.CAP.SqlServer/SqlServerMonitoringApi.cs View File

@@ -128,7 +128,7 @@ select count(Id) from [{0}].Received with (nolock) where StatusName = N'Failed';
var sqlQuery =
$"select count(Id) from [{_options.Schema}].{tableName} with (nolock) where StatusName = @state";

var count = connection.ExecuteScalar<int>(sqlQuery, new {state = statusName});
var count = connection.ExecuteScalar<int>(sqlQuery, new { state = statusName });
return count;
}

@@ -171,10 +171,10 @@ with aggr as (
)
select [Key], [Count] from aggr with (nolock) where [Key] in @keys;";

var valuesMap = connection.Query(
var valuesMap = connection.Query<TimelineCounter>(
sqlQuery,
new {keys = keyMaps.Keys, statusName})
.ToDictionary(x => (string) x.Key, x => (int) x.Count);
new { keys = keyMaps.Keys, statusName })
.ToDictionary(x => x.Key, x => x.Count);

foreach (var key in keyMaps.Keys)
{


+ 8
- 0
src/DotNetCore.CAP/Dashboard/TimelineCounter.cs View File

@@ -0,0 +1,8 @@
namespace DotNetCore.CAP.Dashboard
{
public class TimelineCounter
{
public string Key { get; set; }
public int Count { get; set; }
}
}

Loading…
Cancel
Save