Skip to content

Commit 816f494

Browse files
committed
Optimize Version property in OrchestrationContext to use Lazy initialization for improved performance
1 parent e9c1327 commit 816f494

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/DurableSDK/OrchestrationContext.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,18 @@ public class OrchestrationContext
3737

3838
internal object CustomStatus { get; set; }
3939

40+
private readonly Lazy<string> _version;
41+
42+
public OrchestrationContext()
43+
{
44+
_version = new Lazy<string>(() => OrchestrationVersionExtractor.GetVersionFromHistory(History));
45+
}
46+
4047
public string Version
4148
{
4249
get
4350
{
44-
return OrchestrationVersionExtractor.GetVersionFromHistory(History);
51+
return _version.Value;
4552
}
4653
}
4754
}

0 commit comments

Comments
 (0)