Skip to content

Commit 2de490c

Browse files
committed
Introduce constant for todo list registry id
1 parent ef769cd commit 2de490c

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
public static class Constants
22
{
33
public const string StateStorageProviderName = "StateStorage";
4+
5+
public const string TodoListRegistryId = "registry";
46
}

orleans/JournaledTodoList/JournaledTodoList.WebApp/Grains/TodoListGrain.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public async Task SetNameAsync(string listName)
8787
// Publish list with new name to todo list registry.
8888
// The registry only cares about the id and name of the list,
8989
// so this is the only place where we need to interact with the registry.
90-
var registry = GrainFactory.GetGrain<ITodoListRegistryGrain>("registry");
90+
var registry = GrainFactory.GetGrain<ITodoListRegistryGrain>(Constants.TodoListRegistryId);
9191
await registry.RegisterTodoListAsync(new TodoListReference(this.GetPrimaryKeyString(), listName));
9292
}
9393

orleans/JournaledTodoList/JournaledTodoList.WebApp/Services/TodoListService.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ public class TodoListService(IGrainFactory grainFactory)
99
{
1010
public async Task<IDisposable> SubscribeAsync(ITodoListRegistryObserver observer)
1111
{
12-
var registryGrain = grainFactory.GetGrain<ITodoListRegistryGrain>("registry");
12+
var registryGrain = grainFactory.GetGrain<ITodoListRegistryGrain>(Constants.TodoListRegistryId);
1313
var observerRef = grainFactory.CreateObjectReference<ITodoListRegistryObserver>(observer);
1414
await registryGrain.Subscribe(observerRef);
1515
return new Subscription(observerRef, registryGrain);
1616
}
1717

1818
public Task<ImmutableArray<TodoListReference>> GetTodoListReferencesAsync()
1919
{
20-
var registryGrain = grainFactory.GetGrain<ITodoListRegistryGrain>("registry");
20+
var registryGrain = grainFactory.GetGrain<ITodoListRegistryGrain>(Constants.TodoListRegistryId);
2121
return registryGrain.GetAllTodoListsAsync();
2222
}
2323

0 commit comments

Comments
 (0)