I am serializing events with Serilog, this events can be sent from a wide arrange of services that extend a base abstract class that contains the essential information for any event, and the child classes add all needed specific event information.
The problem is that in the log only the child class properties are being stored and the parent ones are left out. Is there a way to force serilog to include the base class properties on its serialization?
I tried changing the base class to non-abstract and also setting the Destructor.ToMaximumLength to 10000 but still no luck.
public abstract class AnalyticsEvent
{
public readonly Guid EventId = Guid.NewGuid();
public readonly DateTimeOffset EventTime = DateTimeOffset.UtcNow;
public readonly EventGroups EventGroup;
public readonly Guid? TransactionId;
public readonly string EventName;
public AnalyticsEvent(EventGroups eventGroup, Guid? transactionId, string eventName)
{
EventGroup = eventGroup;
TransactionId = transactionId;
EventName = eventName;
}
}