/// <summary> /// Base constructor passing the stream event and eventually the CreatedBy field /// </summary> /// <param name="streamEvent">The stream event of the model</param> /// <param name="createdBy">The source of the creation, if not specified if take the standard value "backend"</param> public WebSocketStream(IStreamEvent streamEvent, string createdBy = "backend") { StreamEvent = streamEvent; CreatedBy = createdBy; CreatedAt = DateTime.UtcNow; UpdatedBy = CreatedBy; UpdatedAt = DateTime.UtcNow; IsDeleted = false; }
/// <summary> /// Method that encapsulate the business logic to store the event /// </summary> /// <param name="streamEvent">The stream event that need to be stored</param> /// <param name="source">A string description of the event source</param> /// <returns></returns> public async Task StoreEventAsync(IStreamEvent streamEvent, string source) { await mongo.InsertEventAsync(new WebSocketStream(streamEvent, source)); }