From 9f6960e7099fead5560d7c0f4a29e8ba73008a83 Mon Sep 17 00:00:00 2001 From: Jacob Viau Date: Fri, 6 Oct 2023 14:45:52 -0700 Subject: [PATCH 1/2] Add GetState() extension method --- src/Abstractions/Entities/TaskEntityState.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/Abstractions/Entities/TaskEntityState.cs b/src/Abstractions/Entities/TaskEntityState.cs index 373882d4..4f8a0af7 100644 --- a/src/Abstractions/Entities/TaskEntityState.cs +++ b/src/Abstractions/Entities/TaskEntityState.cs @@ -9,8 +9,16 @@ namespace Microsoft.DurableTask.Entities; public abstract class TaskEntityState { /// - /// Gets the current state for the entity this context is for. This will return null if no state is present, - /// regardless if is a value-type or not. + /// Gets the current state of the entity. This will return null if no state is present, regardless if + /// is a value-type or not. + /// + /// The type to retrieve. + /// The entity state. + public virtual T? GetState() => (T?)this.GetState(typeof(T)); + + /// + /// Gets the current state of the entity. This will return null if no state is present, regardless if + /// is a value-type or not. /// /// The type to retrieve the state as. /// The entity state. From 995968078fd9ab925379bc368596188c61bc39ca Mon Sep 17 00:00:00 2001 From: Jacob Viau Date: Fri, 6 Oct 2023 14:50:35 -0700 Subject: [PATCH 2/2] Add GetInput() as well --- src/Abstractions/Entities/TaskEntityOperation.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Abstractions/Entities/TaskEntityOperation.cs b/src/Abstractions/Entities/TaskEntityOperation.cs index a3883e8f..4f696313 100644 --- a/src/Abstractions/Entities/TaskEntityOperation.cs +++ b/src/Abstractions/Entities/TaskEntityOperation.cs @@ -28,6 +28,13 @@ public abstract class TaskEntityOperation /// public abstract bool HasInput { get; } + /// + /// Gets the input for this operation. + /// + /// The type to deserialize the input as. + /// The deserialized input type. + public virtual T? GetInput() => (T?)this.GetInput(typeof(T)); + /// /// Gets the input for this operation. ///