Skip to content

Commit

Permalink
refactor: update ToEvent extension
Browse files Browse the repository at this point in the history
  • Loading branch information
WeihanLi committed Jan 3, 2025
1 parent 07f9da5 commit 310abe4
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/WeihanLi.Common/Event/EventBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,15 +112,11 @@ private static IEvent GetEvent<TEvent>(this TEvent @event)
};
}

public static IEventBase ToEventBase(this string eventMsg)
public static TEvent ToEvent<TEvent>(this string eventMsg)
{
Guard.NotNull(eventMsg);
return eventMsg.JsonToObject<IEventBase>(EventSerializerSettings);
return eventMsg.JsonToObject<TEvent>(EventSerializerSettings);
}

public static IEvent ToEvent(this string eventMsg)
{
Guard.NotNull(eventMsg);
return eventMsg.JsonToObject<IEvent>(EventSerializerSettings);
}
public static IEvent ToEvent(this string eventMsg) => ToEvent<IEvent>(eventMsg);
}

0 comments on commit 310abe4

Please sign in to comment.