My software collects measurement data from physical objects. The incoming data looks like this:
public enum Evaluation
{
Accept,
Reject,
Error
}
public record MeasuredValue(string MeasurementName, object Value, Type valueType);
public record MeasurementResult(DateTimeOffset Timestamp, IEnumerable<MeasuredValue> Values, Evaluation Evaluation);
I don’t know in advance what MeasuredValue
s I’ll have, but after some time the application will reach a point when every MeasurementResult
has the same number of MeasuredValue
s (10-15) with the same names. So it would probably make sense to store every MeasurementResult
in a single table, because storing every MeasurementResult in their own record (in a separate table) would create an insane number of records and make querying pretty difficult. By default OwnsMany
seems to create a separate table, which would normally make sense, but not for my specific use case (especially since I’m getting objects in my API so it would be pretty difficult to store in this format)
I’ve tried implementing the solution shown in this article, but it’s probably too generic and feels like a bit of an overkill for my specific problem.
In case the article is gone, here’s a short summary of the approach described: They create a MetaModel
of the database, storing entities and associated fields as objects and build the actual EF Core entities in OnModelCreating
using this data.