orleans icon indicating copy to clipboard operation
orleans copied to clipboard

Why can't I use the Microsoft.Orleans.Persistence.Memory library at all when following your official documentation?

Open TianMaiCheng opened this issue 2 months ago • 6 comments

Why can't I use the Microsoft.Orleans.Persistence.Memory library at all when following your official documentation?

The documentation you provided looks like this:

using Microsoft.Extensions.Hosting;
using Orleans.Configuration;
using Orleans.Hosting;

var builder = Host.CreateApplicationBuilder(args)
    .UseOrleans(siloBuilder =>
    {
        siloBuilder
            .UseLocalhostClustering()
            // Configure Redis as grain storage
            .AddRedisGrainStorage(
                name: "redisStore",
                configureOptions: options =>
                {
                    options.ConnectionString = "localhost:6379";
                    options.Database = 0;
                    options.UseJson = true; // Serializes grain state as JSON
                    options.KeyPrefix = "grain-"; // Optional prefix for Redis keys
                });
    });

// Run the host
await builder.RunAsync();

This is the most basic example, but it can't even pass compilation. How exactly are we supposed to use this? Why can't even a simple HelloWorld program run properly? Has Microsoft become so incompetent now?

Microsoft's documentation used to be the best in the world. What's going on now? How can you not even get a simple HelloWorld documentation right?

TianMaiCheng avatar Nov 08 '25 02:11 TianMaiCheng

Which documentation are you referring to, could you link to it? Your question asks about in-memory persistence but the code you included is for Redis.

ReubenBond avatar Nov 09 '25 21:11 ReubenBond

This is the most basic knowledge, and I certainly wouldn't miss it. Your library can't even pass the most basic compilation. I'm using .NET Core 8.0.

TianMaiCheng avatar Nov 10 '25 00:11 TianMaiCheng

If you provide more information, we may be able to assist you

ReubenBond avatar Nov 10 '25 01:11 ReubenBond

ImageHave you seen that it directly throws an error?

TianMaiCheng avatar Nov 10 '25 08:11 TianMaiCheng

@TianMaiCheng where did you find this in documentation? I'd like to fix the corresponding documentation. This is not how Redis storage should be configured. Here is an example of how it should be configured:

hostBuilder.UseOrleans((ctx, siloBuilder) =>
{
    siloBuilder
        .AddRedisGrainStorage("redisStore", options =>
        {
            options.ConfigurationOptions = ConfigurationOptions.Parse(connectionString);
            options.EntryExpiry = TimeSpan.FromHours(1);
        })
        .AddMemoryGrainStorage("MemoryStore");
});

The ConfigurationOptions property is where the Redis client options are configured. It has the type StackExchange.Redis.ConfigurationOptions.

ReubenBond avatar Nov 10 '25 17:11 ReubenBond

Address is here: https://www.nuget.org/packages/Microsoft.Orleans.Persistence.Redis

TianMaiCheng avatar Nov 11 '25 01:11 TianMaiCheng