我正在学习dotnet核心并尝试向我正在使用的api添加运行状况检查。我添加了AspNetCore.HealthChecks.NpgSql
nuget并添加到startup.cs:
services.AddHealthChecks()
.AddNpgSql(connectionString);
但我收到错误消息:
Error CS1503 Argument 2: cannot convert from 'MovieApp.ConnectionString' to 'string' MovieApp
我在ConfigureServices
中的连接字符串是:
var connectionString = new ConnectionString(Configuration.GetConnectionString("DefaultConnection"));
使用ConnectionString.cs
namespace MovieApp
{
public sealed class ConnectionString
{
public ConnectionString(string value) => Value = value;
public string Value { get; }
}
}
任何想法我在做什么错?
答案 0 :(得分:2)
var x = zone[index].x,
y = zone[index].y,
width = zone[index].width,
height = zone[index].height;
if(isPointInRect(mouseInfo, {x, y, width, height}) {
//perhaps if you want to make a hover color, do that here, just un-comment if you want:
/*ctx.fillStyle = "#ffaaee";*/
if(mouseInfo.clicked) {
ctx.fillStyle = "ff0000"; //red
}
}
ctx.fillStyle = 'yellow';
ctx.rect(x, y, width, height);
...
在传递AddNpgSql(string)
类型的同时接受参数的字符串类型,尝试改用ConnectionString
:
connectionString.Value