/// <summary> /// 将 <see cref="SourceInfo" /> 的字符串表示形式转换为它的等效的 <see cref="SourceInfo" />。一个指示转换是否成功的返回值。 /// </summary> public static bool TryParse(string input, out SourceInfo result) { try { result = Parse(input); return(true); } catch (Exception) { result = null; return(false); } }
private static Envelope <IEvent> Convert(IVersionedEvent @event, SourceInfo sourceInfo, Envelope <ICommand> command) { var envelope = new Envelope <IEvent>(@event, MD5(string.Format("{0}&{1}", sourceInfo.Id, command.MessageId))); if (command.Items.ContainsKey(StandardMetadata.TraceInfo)) { envelope.Items[StandardMetadata.TraceInfo] = command.Items[StandardMetadata.TraceInfo]; } envelope.Items[StandardMetadata.SourceInfo] = sourceInfo; envelope.Items[StandardMetadata.CommandInfo] = new SourceInfo(command.MessageId, command.Body.GetType()); return(envelope); }
public virtual int GetPublishedVersion(SourceInfo sourceInfo) { return(0); }
public virtual void AddOrUpdatePublishedVersion(SourceInfo sourceInfo, int version) { }
void IEventPublishedVersionStore.AddOrUpdatePublishedVersion(SourceInfo sourceInfo, int version) { AddOrUpdatePublishedVersionToMemory(sourceInfo, version); AddOrUpdatePublishedVersion(sourceInfo, version); }
private static bool IsEqual(SourceInfo left, SourceInfo right) { return(string.Equals(left.Id, right.Id, StringComparison.CurrentCultureIgnoreCase) && left.Type == right.Type); }
public bool Save(SourceInfo sourceInfo, IEnumerable <IVersionedEvent> events, string correlationId) { var set = collection.GetOrAdd(sourceInfo, () => new HashSet <EventCollection>()); return(set.Add(new EventCollection(correlationId, events))); }