Compare commits
No commits in common. "e8aa6423edee7e6698f601952541671e6c53407d" and "d38f26291f07364a9a1fe3f7f51c55f58bfdc54c" have entirely different histories.
e8aa6423ed
...
d38f26291f
@ -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>();
|
||||
}
|
||||
@ -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; }
|
||||
}
|
||||
@ -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>();
|
||||
}
|
||||
@ -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)
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user