Merge pull request #3 from TimetableDesigner/dev
Refactor Event creation to use generic method
This commit is contained in:
@@ -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 => new Event
|
||||
{
|
||||
Payload = JsonSerializer.Serialize(payload);
|
||||
PayloadType = payload.GetType().FullName!;
|
||||
}
|
||||
Payload = JsonSerializer.Serialize<T>(payload),
|
||||
PayloadType = payload.GetType().FullName!
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user