static EventData CreateEvent(string id, params Include[] includes) { var properties = new Dictionary <string, EntityProperty> { { "Id", new EntityProperty(id) }, { "Type", new EntityProperty("StreamChanged") }, { "Data", new EntityProperty("{}") } }; return(new EventData( EventId.From(id), EventProperties.From(properties), EventIncludes.From(includes))); }
static EventData Event(object @event, params Include[] includes) { var id = Guid.NewGuid(); var properties = new { Type = @event.GetType().Name, Data = JsonConvert.SerializeObject(@event) }; return(new EventData( EventId.From(id), EventProperties.From(properties), EventIncludes.From(includes))); }
public void When_single_event_along_with_includes_is_over_WATS_max_batch_size_limit() { var stream = new Stream(partition); var includes = Enumerable .Range(1, Api.AzureMaxBatchSize) .Select(i => Include.Insert(new TestEntity(i.ToString()))) .ToArray(); var @event = new EventData( EventId.From("offsize"), EventIncludes.From(includes) ); Assert.ThrowsAsync <InvalidOperationException>( async() => await Stream.WriteAsync(stream, @event)); }
public static EventData ToEventData(this DomainEvent e, int version, params ITableEntity[] includes) { // Properties are turned into columns in the table, which can be // convenient for quickly glancing at the data. var properties = new { // Visualizing the event id in the table as a column is useful for querying e.EventId, EventType = e.GetType().FullName, Data = new Serializer().Serialize(e), DataVersion = (e.GetType().Assembly.GetName().Version ?? new Version(1, 0)).ToString(2), Version = version, }; return(new EventData( // This turns off the SS-UID-[id] duplicate event detection rows, since // we use GUIDs for events and therefore we'll never be duplicating EventId.None, EventProperties.From(properties), EventIncludes.From(includes.Select(x => Include.InsertOrReplace(x))))); }
static EventData CreateEvent(params Include[] includes) { return(new EventData(EventId.None, EventProperties.None, EventIncludes.From(includes))); }
static EventData Event(params Include[] includes) { return(new EventData(EventId.None, EventIncludes.From(includes))); }