public void SaveEndpoint(Endpoint endpoint)
{
using (var conn = _db.OpenConnection())
using (var tx = conn.BeginTransaction())
{
var tags = endpoint.Metadata.Tags.ToDbString();
conn.Execute(
$"replace into EndpointConfig(MonitorType, Address, GroupName, Name, Id, Password, RegisteredOnUtc, RegistrationUpdatedOnUtc, MonitorTag{(tags != null ? ", Tags" : "")}) values(@MonitorType,@Address,@Group,@Name,@Id,@Password,@RegisteredOnUtc,@RegistrationUpdatedOnUtc,@MonitorTag{(tags != null ? ",@Tags" : "")})",
new
{
endpoint.Identity.MonitorType,
endpoint.Identity.Address,
endpoint.Metadata.Group,
endpoint.Metadata.Name,
endpoint.Identity.Id,
endpoint.Password,
endpoint.Metadata.RegisteredOnUtc,
endpoint.Metadata.RegistrationUpdatedOnUtc,
endpoint.Metadata.MonitorTag,
tags
}, tx);
tx.Commit();
}
}