Example #1
0
 public static void CreateDb()
 {
     Console.WriteLine("Creating tables in database");
     db.CreateTable <Sensor> ();
     Console.WriteLine("Creating sensors in database");
     db.CreateTable <SensorReading> ();
     Console.WriteLine("Storing sensor indexes");
     ISensor[] sensors = SensorFactory.GetSensorArray();
     foreach (var sensor in sensors)
     {
         var sensorToInsert = new Sensor()
         {
             Port = sensor.Port.ToString(), Mode = sensor.SelectedMode(), Name = sensor.GetSensorName()
         };
         db.Insert(sensorToInsert);                //id in the sensorToInsert is updated
         sensorsDictionary.Add(sensorToInsert.Id, sensor);
     }
 }