Refactor Event creation to use generic method

This commit is contained in:
2026-01-28 23:59:19 +01:00
committed by GitHub
Unverified
parent 98e2ae5c2c
commit cf7f922aed

View File

@@ -11,9 +11,9 @@ public class Event
public DateTimeOffset? LastRetryOn { get; set; }
public uint RetryCount { get; set; }
public Event(object payload)
public static Event Create<T>(T payload) where T : class
{
Payload = JsonSerializer.Serialize(payload);
Payload = JsonSerializer.Serialize<T>(payload);
PayloadType = payload.GetType().FullName!;
}
}