public void DeleteSensor(SensorInfo sensor) { this._logger.LogInformation($"Deleting sensor: {sensor.TypeName}"); using (var uow = new UnitOfWork<SensorPoco>(new RomiDbContext())) { var poco = this._mapper.Map<SensorPoco>(sensor); uow.Repository().Delete(poco); } }
internal Sensor(SensorInfo info, IMapper mapper) : this(mapper) { if (info == null) { throw new ArgumentNullException(); } var typeName = this.GetType().FullName; if (info.TypeName != typeName) { throw new Exception("Type does not match target sensor"); } Id = info.Id; TypeName = info.TypeName; }
public async Task<Sensor> GetSensor(SensorInfo sensorInfo) { return await GetSensor(sensorInfo?.TypeName); }