Skip to content

Commit d667fa4

Browse files
CopilotYunchuWang
andcommitted
Update Lifetime sample with async initialization documentation
Co-authored-by: YunchuWang <[email protected]>
1 parent 831faf0 commit d667fa4

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

samples/AzureFunctionsApp/Entities/Lifetime.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,12 @@ public void Delete()
7575
protected override MyState InitializeState(TaskEntityOperation operation)
7676
{
7777
// This method allows for customizing the default state value for a new entity.
78+
// For async initialization (e.g., loading from a database or external storage), override InitializeStateAsync instead:
79+
// protected override async ValueTask<MyState> InitializeStateAsync(TaskEntityOperation operation)
80+
// {
81+
// var data = await LoadFromDatabaseAsync();
82+
// return new MyState(data.PropA, data.PropB);
83+
// }
7884
return new(Guid.NewGuid().ToString("N"), Random.Shared.Next(0, 1000));
7985
}
8086
}

0 commit comments

Comments
 (0)