EmbeddedMap<TKey, TValue> — a collection keyed by a property of the value
public class OpeningHours {
public Guid Id { get; set; }
public string DayCode { get; set; } = string.Empty; // "mon", "tue", …
public TimeSpan Opens { get; set; }
public TimeSpan Closes { get; set; }
}
public interface IVenue {
// ...
[EmbeddedMapProperty(KeyProperty = nameof(OpeningHours.DayCode))]
EmbeddedMap<string, OpeningHours> Hours { get; }
}KeyProperty names the property that holds the key. It must be declared on the closest common base
of the allowed value types, and its type must be TKey; the model builder checks both. To key by the
value's id instead, set KeyType to KeyPropertyType.NodeGuidId or NodeIntegerId. Without an
attribute, a Guid or int key means the value's id, and any other key type is an error.