private object ToEvent(PropertyMap eventProperties) { var type = eventProperties[nameof(EventStorageData.EventType)].StringValue; var typeOfEvent = _typeResolver.Get(type); var data = eventProperties[nameof(EventStorageData.Content)].StringValue; return(JsonConvert.DeserializeObject(data, typeOfEvent)); }
public static string GetSurrogateKeyType(this ClassModel @class, ITypeResolver typeResolver) { if (!HasSurrogateKey(@class)) { throw new Exception($"{nameof(ClassModel)} [{@class}] does not have a surrogate key"); } return(@class.GetExplicitPrimaryKey().Any() ? typeResolver.Get(@class.GetExplicitPrimaryKey().SingleOrDefault()?.Type.Element).Name : "Guid"); }
public object PendingEventToEvent(PendingEvent pendingEvent) { return(JsonConvert.DeserializeObject(pendingEvent.Content, _typeResolver.Get(pendingEvent.EventType))); }