diff --git a/src/DurableTask.Core/Entities/EntityMessageEvent.cs b/src/DurableTask.Core/Entities/EntityMessageEvent.cs index 924d5c7fd..4faf66512 100644 --- a/src/DurableTask.Core/Entities/EntityMessageEvent.cs +++ b/src/DurableTask.Core/Entities/EntityMessageEvent.cs @@ -13,8 +13,8 @@ #nullable enable using System; using DurableTask.Core.Entities.EventFormat; +using DurableTask.Core.Serializing.Internal; using Newtonsoft.Json; -using Newtonsoft.Json.Linq; namespace DurableTask.Core.Entities { @@ -50,21 +50,11 @@ public override string ToString() /// public OrchestrationInstance TargetInstance => this.target; - /// - /// Returns the content of this event, as an object that can be serialized later. - /// - /// - public object ContentAsObject() - { - // we pre-serialize this now to avoid interference from the application-defined serialization settings - return JObject.FromObject(message, Serializer.InternalSerializer); - } - /// /// Returns the content of this event, as a serialized string. /// /// - public string ContentAsString() + public string AsSerializedString() { return JsonConvert.SerializeObject(message, Serializer.InternalSerializerSettings); } @@ -78,13 +68,24 @@ public TaskMessage AsTaskMessage() return new TaskMessage { OrchestrationInstance = this.target, - Event = new History.EventRaisedEvent(-1, this.ContentAsString()) + Event = new History.EventRaisedEvent(-1, this.AsSerializedString()) { Name = this.eventName } }; } +#pragma warning disable CS0618 // Type or member is obsolete. Intentional internal usage. + /// + /// Returns the content as an already-serialized string. Can be used to bypass the application-defined serializer. + /// + /// + public RawInput AsRawInput() + { + return new RawInput(this.AsSerializedString()); + } +#pragma warning restore CS0618 // Type or member is obsolete + /// /// Utility function to compute a capped scheduled time, given a scheduled time, a timestamp representing the current time, and the maximum delay. /// diff --git a/src/DurableTask.Core/TaskOrchestrationContext.cs b/src/DurableTask.Core/TaskOrchestrationContext.cs index 2eaa1abf9..77589ed27 100644 --- a/src/DurableTask.Core/TaskOrchestrationContext.cs +++ b/src/DurableTask.Core/TaskOrchestrationContext.cs @@ -199,7 +199,8 @@ public override void SendEvent(OrchestrationInstance orchestrationInstance, stri } int id = this.idCounter++; - string serializedEventData = this.MessageDataConverter.SerializeInternal(eventData); + + string serializedEventData = this.MessageDataConverter.SerializeInternal(eventData); var action = new SendEventOrchestratorAction {