output-service-tsdb/InfluxDB/MeasurementObject.cs

34 lines
839 B
C#

using System;
using InfluxDB.Client;
using InfluxDB.Client.Api.Domain;
using InfluxDB.Client.Core;
using InfluxDB.Client.Writes;
namespace OutputServiceTSDB.InfluxDB
{
[Measurement("temperature")]
public class MeasurementObject
{
[Column("deviceid", IsTag = true)]
public string DeviceID { get; set; }
private double _probability;
[Column("probability")]
public double Probability
{
get => _probability;
set
{
if (value > 1.0 || value < 0.0)
throw new ArgumentOutOfRangeException(
$"{nameof(value)} must be between 0 and 1.");
else
_probability = value;
}
}
[Column(IsTimestamp = true)] public DateTime Time;
}
}