Open
Description
Please consider the following event:
public record MyEvent(Guid Id, ExtCompKey ItemId);
where ExtCompKey
is a struct
: public record struct ExtCompKey(string Identifier, int Key);
now when I try to Map
it in the flat table projection:
Project<MyEvent>(m =>
{
m.Map(x => x.ItemId.Key);
});
the code generation throws
System.InvalidOperationException: Compilation failures!
CS0023: Operator '?' cannot be applied to operand of type 'ExtCompKey'
...
case Marten.Events.IEvent<(redacted).MyEvent> event_MyEvent112:
operations.QueueSqlCommand("select public.mt_upsert_test1_myevent(?, ?);", event_MyEvent112.StreamId,
event_MyEvent112.Data.ItemId?.Key);
break;
the only workaround I found so far is to enrich the event with a direct accessor (public int ItmKey => ItemId.Key;
) and use it in the Map
expression
Metadata
Assignees
Labels
No labels
Activity