Compare commits

..

No commits in common. "e8aa6423edee7e6698f601952541671e6c53407d" and "d38f26291f07364a9a1fe3f7f51c55f58bfdc54c" have entirely different histories.

6 changed files with 14 additions and 6 deletions

1
.envrc
View File

@ -1 +0,0 @@
use flake

View File

@ -7,5 +7,6 @@ public class ActorType
public int Id { get; set; }
public string Name { get; set; }
// Navigation Property
public List<Actor> Actors { get; set; } = new List<Actor>();
}

View File

@ -1,4 +1,4 @@
namespace Iot.Entities;
namespace Iot.Entities;
using System;
@ -10,6 +10,7 @@ public class Measurement
public int MeasurementTypeId { get; set; }
public double Value { get; set; }
// Navigation Properties
public Actor Actor { get; set; }
public MeasurementType MeasurementType { get; set; }
}

View File

@ -1,4 +1,4 @@
namespace Iot.Entities;
namespace Iot.Entities;
using System.Collections.Generic;
@ -8,5 +8,6 @@ public class MeasurementType
public string Name { get; set; }
public string Comment { get; set; }
// Navigation Property
public List<Measurement> Measurements { get; set; } = new List<Measurement>();
}

View File

@ -1,7 +1,7 @@
/*--------------------------------------------------------------
* HTBLA-Leonding / Class: 4CHIF
/*--------------------------------------------------------------
* HTBLA-Leonding / Class: 1xHIF
*--------------------------------------------------------------
* Musterlösung-Hinterdorfer Jonas
* Musterlösung-HA
*--------------------------------------------------------------
* Description: Iot
*--------------------------------------------------------------
@ -98,18 +98,22 @@ var measurements = measurementsCsv.Select(m =>
};
}).ToList();
// Populate Actor.Measurements using ToLookup (O(n) instead of O(n*m))
var measurementsByActor = measurements.ToLookup(m => m.ActorId);
foreach (var actor in actors)
{
actor.Measurements = measurementsByActor[actor.Id].ToList();
}
// Populate MeasurementType.Measurements using ToLookup (O(n) instead of O(n*m))
var measurementsByType = measurements.ToLookup(m => m.MeasurementTypeId);
foreach (var measurementType in measurementTypes)
{
measurementType.Measurements = measurementsByType[measurementType.Id].ToList();
}
// Populate ActorType.Actors using ToLookup (O(n) instead of O(n*m))
var actorsByType = actors.ToLookup(a => a.ActorTypeId);
foreach (var actorType in actorTypes.Values)
{

View File

@ -16,6 +16,8 @@
devShells.default = pkgs.mkShell {
packages = [
pkgs.dotnet-sdk_9
# alternativ/zusätzlich:
# pkgs.dotnetCorePackages.sdk_9_0
];
};
});