public static async Task <long> AppendToStreamAsync(this IReliableStateManager stateManager, string streamName, long version, IEvent[] events, Func <IEvent, EventData> serializer, string queueName = defaultOutBoxQueueName, string streamsName = defaultStreamsName) { using (var tx = stateManager.CreateTransaction()) { var result = await stateManager.AppendAndMapToStreamAsync(tx, streamName, version, events, serializer, streamsName); await stateManager.EnqueuAsync(tx, result.Item1.Select(x => x.ToEventData()), queueName); await tx.CommitAsync(); return(result.Item2); } }
public static async Task <long> AppendToStreamAsync(this IReliableStateManager stateManager, ITransaction tx, string streamName, long version, IEvent[] events, Func <IEvent, EventData> serializer, string streamsName = defaultStreamsName) => (await stateManager.AppendAndMapToStreamAsync(tx, streamName, version, events, serializer, streamsName)).Item2;