diff --git a/src/WebJobs.Extensions.DurableTask/EntityScheduler/EntityId.cs b/src/WebJobs.Extensions.DurableTask/EntityScheduler/EntityId.cs index 6594f6a88..afc854181 100644 --- a/src/WebJobs.Extensions.DurableTask/EntityScheduler/EntityId.cs +++ b/src/WebJobs.Extensions.DurableTask/EntityScheduler/EntityId.cs @@ -11,6 +11,8 @@ namespace Microsoft.Azure.WebJobs.Extensions.DurableTask /// public struct EntityId : IEquatable, IComparable { + private string schedulerId; + /// /// Create an entity id for an entity. /// @@ -25,6 +27,7 @@ public EntityId(string entityName, string entityKey) this.EntityName = entityName.ToLowerInvariant(); this.EntityKey = entityKey ?? throw new ArgumentNullException(nameof(entityKey), "Invalid entity id: entity key must not be null."); + this.schedulerId = GetSchedulerId(this.EntityName, this.EntityKey); } /// @@ -41,7 +44,12 @@ public EntityId(string entityName, string entityKey) internal static string GetSchedulerIdFromEntityId(EntityId entityId) { - return $"@{entityId.EntityName}@{entityId.EntityKey}"; + return GetSchedulerId(entityId.EntityName, entityId.EntityKey); + } + + private static string GetSchedulerId(string entityName, string entityKey) + { + return $"@{entityName}@{entityKey}"; } internal static string GetSchedulerIdPrefixFromEntityName(string entityName) @@ -60,7 +68,13 @@ internal static EntityId GetEntityIdFromSchedulerId(string schedulerId) /// public override string ToString() { - return GetSchedulerIdFromEntityId(this); + // The scheduler id could be null if the object was deserialized. + if (this.schedulerId == null) + { + this.schedulerId = GetSchedulerIdFromEntityId(this); + } + + return this.schedulerId; } /// @@ -72,21 +86,20 @@ public override bool Equals(object obj) /// public bool Equals(EntityId other) { - return (this.EntityName, this.EntityKey).Equals((other.EntityName, other.EntityKey)); + return this.ToString().Equals(other.ToString()); } /// public override int GetHashCode() { - return (this.EntityName, this.EntityKey).GetHashCode(); + return this.ToString().GetHashCode(); } /// public int CompareTo(object obj) { var other = (EntityId)obj; - return ((IComparable)(this.EntityKey, this.EntityName)) - .CompareTo((other.EntityKey, other.EntityName)); + return this.ToString().CompareTo(other.ToString()); } } } diff --git a/src/WebJobs.Extensions.DurableTask/Microsoft.Azure.WebJobs.Extensions.DurableTask-net471.xml b/src/WebJobs.Extensions.DurableTask/Microsoft.Azure.WebJobs.Extensions.DurableTask-net461.xml similarity index 99% rename from src/WebJobs.Extensions.DurableTask/Microsoft.Azure.WebJobs.Extensions.DurableTask-net471.xml rename to src/WebJobs.Extensions.DurableTask/Microsoft.Azure.WebJobs.Extensions.DurableTask-net461.xml index c947e7f03..7e760a467 100644 --- a/src/WebJobs.Extensions.DurableTask/Microsoft.Azure.WebJobs.Extensions.DurableTask-net471.xml +++ b/src/WebJobs.Extensions.DurableTask/Microsoft.Azure.WebJobs.Extensions.DurableTask-net461.xml @@ -955,6 +955,12 @@ + A terminated instance will eventually transition into the state. + However, this transition will not happen immediately. Rather, the terminate operation will be queued in the task hub + along with other operations for that instance. You can use the + method to know when a terminated instance has actually reached the Terminated state. + + Terminating an orchestration instance has no effect on any in-flight activity function executions or sub-orchestrations that were started by the current orchestration instance. diff --git a/src/WebJobs.Extensions.DurableTask/Microsoft.Azure.WebJobs.Extensions.DurableTask.xml b/src/WebJobs.Extensions.DurableTask/Microsoft.Azure.WebJobs.Extensions.DurableTask.xml index aaac3d3e4..1b56e8793 100644 --- a/src/WebJobs.Extensions.DurableTask/Microsoft.Azure.WebJobs.Extensions.DurableTask.xml +++ b/src/WebJobs.Extensions.DurableTask/Microsoft.Azure.WebJobs.Extensions.DurableTask.xml @@ -993,6 +993,12 @@ + A terminated instance will eventually transition into the state. + However, this transition will not happen immediately. Rather, the terminate operation will be queued in the task hub + along with other operations for that instance. You can use the + method to know when a terminated instance has actually reached the Terminated state. + + Terminating an orchestration instance has no effect on any in-flight activity function executions or sub-orchestrations that were started by the current orchestration instance. diff --git a/src/WebJobs.Extensions.DurableTask/Options/AzureStorageOptions.cs b/src/WebJobs.Extensions.DurableTask/Options/AzureStorageOptions.cs index c1a72c0fc..c6968a93e 100644 --- a/src/WebJobs.Extensions.DurableTask/Options/AzureStorageOptions.cs +++ b/src/WebJobs.Extensions.DurableTask/Options/AzureStorageOptions.cs @@ -163,7 +163,8 @@ internal bool IsSanitizedHubName(string hubName, out string sanitizedHubName) // a number. If it does, prepend "t" to the beginning. if (char.IsNumber(validHubNameCharacters.First())) { - validHubNameCharacters = validHubNameCharacters.Prepend('t'); + validHubNameCharacters = validHubNameCharacters.ToList(); + ((List)validHubNameCharacters).Insert(0, 't'); } sanitizedHubName = new string(validHubNameCharacters diff --git a/src/WebJobs.Extensions.DurableTask/WebJobs.Extensions.DurableTask.csproj b/src/WebJobs.Extensions.DurableTask/WebJobs.Extensions.DurableTask.csproj index 8f76531ac..7d4403ecf 100644 --- a/src/WebJobs.Extensions.DurableTask/WebJobs.Extensions.DurableTask.csproj +++ b/src/WebJobs.Extensions.DurableTask/WebJobs.Extensions.DurableTask.csproj @@ -1,7 +1,7 @@  - netstandard2.0;net471 + netstandard2.0;net461 Microsoft.Azure.WebJobs.Extensions.DurableTask Microsoft.Azure.WebJobs.Extensions.DurableTask 2 @@ -11,6 +11,7 @@ $(MajorVersion).$(MinorVersion).$(PatchVersion) $(MajorVersion).0.0.0 Microsoft Corporation + 7.3 true ..\..\sign.snk true diff --git a/test/Common/TestOrchestrations.cs b/test/Common/TestOrchestrations.cs index 423b1100d..06df7e653 100644 --- a/test/Common/TestOrchestrations.cs +++ b/test/Common/TestOrchestrations.cs @@ -467,7 +467,7 @@ public static DurableHttpRequest ConvertTestRequestToDurableHttpRequest(TestDura StringValues stringValues; if (testHeaders.TryGetValue(header.Key, out stringValues)) { - stringValues.Append(header.Value); + stringValues = StringValues.Concat(stringValues, header.Value); testHeaders[header.Key] = stringValues; } else diff --git a/test/FunctionsV1/WebJobs.Extensions.DurableTask.Tests.V1.csproj b/test/FunctionsV1/WebJobs.Extensions.DurableTask.Tests.V1.csproj index 92350a288..64558a4da 100644 --- a/test/FunctionsV1/WebJobs.Extensions.DurableTask.Tests.V1.csproj +++ b/test/FunctionsV1/WebJobs.Extensions.DurableTask.Tests.V1.csproj @@ -1,7 +1,7 @@  - net471 + net461 Microsoft Corporation SA0001;SA1600;SA1615 true