Skip to content

Commit 1094435

Browse files
CopilotReubenBond
andcommitted
Update READMEs to include complete samples with grain references, calls, and shutdown
Co-authored-by: ReubenBond <[email protected]>
1 parent 4fc27e6 commit 1094435

File tree

38 files changed

+218
-60
lines changed

38 files changed

+218
-60
lines changed

src/AWS/Orleans.Clustering.DynamoDB/README.md

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ dotnet add package Microsoft.Orleans.Clustering.DynamoDB
1414
```csharp
1515
using Microsoft.Extensions.Hosting;
1616
using Orleans.Hosting;
17+
using Microsoft.Extensions.DependencyInjection;
18+
using System;
19+
using System.Threading.Tasks;
1720

1821
var builder = new HostBuilder()
1922
.UseOrleans(siloBuilder =>
@@ -30,13 +33,24 @@ var builder = new HostBuilder()
3033
});
3134
});
3235

33-
// Run the host
34-
await builder.RunConsoleAsync();
36+
var host = builder.Build();
37+
await host.StartAsync();
38+
39+
// Get a reference to a grain and call it
40+
var client = host.Services.GetRequiredService<IClusterClient>();
41+
var grain = client.GetGrain<IHelloGrain>("user123");
42+
var response = await grain.SayHello("DynamoDB");
43+
44+
// Print the result
45+
Console.WriteLine($"Grain response: {response}");
46+
47+
// Keep the host running until the application is shut down
48+
await host.WaitForShutdownAsync();
3549
```
3650

3751
## Documentation
3852
For more comprehensive documentation, please refer to:
39-
- [Microsoft Orleans Documentation](https://docs.microsoft.com/dotnet/orleans/)
53+
- [Microsoft Orleans Documentation](https://learn.microsoft.com/dotnet/orleans/)
4054
- [Configuration Guide](https://learn.microsoft.com/en-us/dotnet/orleans/host/configuration-guide/)
4155
- [Orleans Clustering](https://learn.microsoft.com/en-us/dotnet/orleans/implementation/cluster-management)
4256
- [AWS SDK for .NET Documentation](https://docs.aws.amazon.com/sdk-for-net/index.html)

src/AWS/Orleans.Persistence.DynamoDB/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public class MyGrain : Grain, IMyGrain, IGrainWithStringKey
7474

7575
## Documentation
7676
For more comprehensive documentation, please refer to:
77-
- [Microsoft Orleans Documentation](https://docs.microsoft.com/dotnet/orleans/)
77+
- [Microsoft Orleans Documentation](https://learn.microsoft.com/dotnet/orleans/)
7878
- [Grain Persistence](https://learn.microsoft.com/en-us/dotnet/orleans/grains/grain-persistence)
7979
- [AWS SDK for .NET Documentation](https://docs.aws.amazon.com/sdk-for-net/index.html)
8080

src/AWS/Orleans.Reminders.DynamoDB/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public class ReminderGrain : Grain, IReminderGrain, IRemindable
7575

7676
## Documentation
7777
For more comprehensive documentation, please refer to:
78-
- [Microsoft Orleans Documentation](https://docs.microsoft.com/dotnet/orleans/)
78+
- [Microsoft Orleans Documentation](https://learn.microsoft.com/dotnet/orleans/)
7979
- [Reminders and Timers](https://learn.microsoft.com/en-us/dotnet/orleans/grains/timers-and-reminders)
8080
- [Reminder Services](https://learn.microsoft.com/en-us/dotnet/orleans/implementation/reminder-services)
8181
- [AWS SDK for .NET Documentation](https://docs.aws.amazon.com/sdk-for-net/index.html)

src/AWS/Orleans.Streaming.SQS/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public class ConsumerGrain : Grain, IConsumerGrain, IAsyncObserver<string>
9898

9999
## Documentation
100100
For more comprehensive documentation, please refer to:
101-
- [Microsoft Orleans Documentation](https://docs.microsoft.com/dotnet/orleans/)
101+
- [Microsoft Orleans Documentation](https://learn.microsoft.com/dotnet/orleans/)
102102
- [Orleans Streams](https://learn.microsoft.com/en-us/dotnet/orleans/streaming/index)
103103
- [Stream Providers](https://learn.microsoft.com/en-us/dotnet/orleans/streaming/stream-providers)
104104
- [AWS SDK for .NET Documentation](https://docs.aws.amazon.com/sdk-for-net/index.html)

src/AdoNet/Orleans.Clustering.AdoNet/README.md

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ You will also need to install the appropriate database driver package for your d
2424
using Microsoft.Extensions.Hosting;
2525
using Orleans.Configuration;
2626
using Orleans.Hosting;
27+
using Microsoft.Extensions.DependencyInjection;
28+
using System;
29+
using System.Threading.Tasks;
2730

2831
var builder = Host.CreateApplicationBuilder(args)
2932
.UseOrleans(siloBuilder =>
@@ -37,8 +40,19 @@ var builder = Host.CreateApplicationBuilder(args)
3740
});
3841
});
3942

40-
// Run the host
41-
await builder.RunConsoleAsync();
43+
var host = builder.Build();
44+
await host.StartAsync();
45+
46+
// Get a reference to a grain and call it
47+
var client = host.Services.GetRequiredService<IClusterClient>();
48+
var grain = client.GetGrain<IHelloGrain>("user123");
49+
var response = await grain.SayHello("World");
50+
51+
// Print the result
52+
Console.WriteLine($"Grain response: {response}");
53+
54+
// Keep the host running until the application is shut down
55+
await host.WaitForShutdownAsync();
4256
```
4357

4458
## Example - Configuring Client to Connect to Cluster
@@ -47,6 +61,9 @@ await builder.RunConsoleAsync();
4761
using Microsoft.Extensions.Hosting;
4862
using Orleans;
4963
using Orleans.Configuration;
64+
using Microsoft.Extensions.DependencyInjection;
65+
using System;
66+
using System.Threading.Tasks;
5067

5168
var clientBuilder = Host.CreateApplicationBuilder(args)
5269
.UseOrleansClient(clientBuilder =>
@@ -60,13 +77,17 @@ var clientBuilder = Host.CreateApplicationBuilder(args)
6077
});
6178
});
6279

63-
var host = await clientBuilder.StartAsync();
80+
var host = clientBuilder.Build();
81+
await host.StartAsync();
6482
var client = host.Services.GetRequiredService<IClusterClient>();
6583

6684
// Get a reference to a grain and call it
6785
var grain = client.GetGrain<IHelloGrain>("user123");
6886
var response = await grain.SayHello("World");
6987

88+
// Print the result
89+
Console.WriteLine($"Grain response: {response}");
90+
7091
// Keep the host running until the application is shut down
7192
await host.WaitForShutdownAsync();
7293
```

src/AdoNet/Orleans.Persistence.AdoNet/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ Before using the ADO.NET provider, you need to set up the necessary database tab
9292

9393
## Documentation
9494
For more comprehensive documentation, please refer to:
95-
- [Microsoft Orleans Documentation](https://docs.microsoft.com/dotnet/orleans/)
95+
- [Microsoft Orleans Documentation](https://learn.microsoft.com/dotnet/orleans/)
9696
- [Grain Persistence](https://learn.microsoft.com/en-us/dotnet/orleans/grains/grain-persistence)
9797
- [Relational Database Persistence](https://learn.microsoft.com/en-us/dotnet/orleans/grains/grain-persistence/relational-storage)
9898

src/AdoNet/Orleans.Reminders.AdoNet/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public class ReminderGrain : Grain, IReminderGrain, IRemindable
8585

8686
## Documentation
8787
For more comprehensive documentation, please refer to:
88-
- [Microsoft Orleans Documentation](https://docs.microsoft.com/dotnet/orleans/)
88+
- [Microsoft Orleans Documentation](https://learn.microsoft.com/dotnet/orleans/)
8989
- [Reminders and Timers](https://learn.microsoft.com/en-us/dotnet/orleans/grains/timers-and-reminders)
9090
- [Reminder Services](https://learn.microsoft.com/en-us/dotnet/orleans/implementation/reminder-services)
9191
- [ADO.NET Database Setup](https://learn.microsoft.com/en-us/dotnet/orleans/host/configuration-guide/adonet-configuration)

src/AdoNet/Orleans.Streaming.AdoNet/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ public class ConsumerGrain : Grain, IConsumerGrain, IAsyncObserver<string>
110110

111111
## Documentation
112112
For more comprehensive documentation, please refer to:
113-
- [Microsoft Orleans Documentation](https://docs.microsoft.com/dotnet/orleans/)
113+
- [Microsoft Orleans Documentation](https://learn.microsoft.com/dotnet/orleans/)
114114
- [Orleans Streams](https://learn.microsoft.com/en-us/dotnet/orleans/streaming/index)
115115
- [Stream Providers](https://learn.microsoft.com/en-us/dotnet/orleans/streaming/stream-providers)
116116
- [ADO.NET Database Setup](https://learn.microsoft.com/en-us/dotnet/orleans/host/configuration-guide/adonet-configuration)

src/Azure/Orleans.Clustering.AzureStorage/README.md

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ dotnet add package Microsoft.Orleans.Clustering.AzureStorage
1616
using Microsoft.Extensions.Hosting;
1717
using Orleans.Configuration;
1818
using Orleans.Hosting;
19+
using Microsoft.Extensions.DependencyInjection;
20+
using System;
21+
using System.Threading.Tasks;
1922

2023
var builder = new HostBuilder()
2124
.UseOrleans(siloBuilder =>
@@ -34,8 +37,19 @@ var builder = new HostBuilder()
3437
});
3538
});
3639

37-
// Run the host
38-
await builder.RunConsoleAsync();
40+
var host = builder.Build();
41+
await host.StartAsync();
42+
43+
// Get a reference to a grain and call it
44+
var client = host.Services.GetRequiredService<IClusterClient>();
45+
var grain = client.GetGrain<IHelloGrain>("user123");
46+
var response = await grain.SayHello("World");
47+
48+
// Print the result
49+
Console.WriteLine($"Grain response: {response}");
50+
51+
// Keep the host running until the application is shut down
52+
await host.WaitForShutdownAsync();
3953
```
4054

4155
## Example - Configuring Client to Connect to Cluster
@@ -44,6 +58,9 @@ await builder.RunConsoleAsync();
4458
using Microsoft.Extensions.Hosting;
4559
using Orleans;
4660
using Orleans.Configuration;
61+
using Microsoft.Extensions.DependencyInjection;
62+
using System;
63+
using System.Threading.Tasks;
4764

4865
var clientBuilder = new HostBuilder()
4966
.UseOrleansClient(clientBuilder =>
@@ -62,13 +79,24 @@ var clientBuilder = new HostBuilder()
6279
});
6380
});
6481

65-
var host = await clientBuilder.StartAsync();
82+
var host = clientBuilder.Build();
83+
await host.StartAsync();
6684
var client = host.Services.GetRequiredService<IClusterClient>();
85+
86+
// Get a reference to a grain and call it
87+
var grain = client.GetGrain<IHelloGrain>("user123");
88+
var response = await grain.SayHello("World");
89+
90+
// Print the result
91+
Console.WriteLine($"Grain response: {response}");
92+
93+
// Keep the host running until the application is shut down
94+
await host.WaitForShutdownAsync();
6795
```
6896

6997
## Documentation
7098
For more comprehensive documentation, please refer to:
71-
- [Microsoft Orleans Documentation](https://docs.microsoft.com/dotnet/orleans/)
99+
- [Microsoft Orleans Documentation](https://learn.microsoft.com/dotnet/orleans/)
72100
- [Clustering providers](https://learn.microsoft.com/en-us/dotnet/orleans/implementation/cluster-management)
73101
- [Azure Storage provider](https://learn.microsoft.com/en-us/dotnet/orleans/implementation/azure-storage-providers)
74102

src/Azure/Orleans.Clustering.Cosmos/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ await builder.RunConsoleAsync();
3434

3535
## Documentation
3636
For more comprehensive documentation, please refer to:
37-
- [Microsoft Orleans Documentation](https://docs.microsoft.com/dotnet/orleans/)
37+
- [Microsoft Orleans Documentation](https://learn.microsoft.com/dotnet/orleans/)
3838
- [Configuration Guide](https://learn.microsoft.com/en-us/dotnet/orleans/host/configuration-guide/)
3939
- [Orleans Clustering](https://learn.microsoft.com/en-us/dotnet/orleans/implementation/cluster-management)
4040

0 commit comments

Comments
 (0)