How can resolved Grains and IGrains in Silo and Client side in Orleans 8.1 #9025
Answered
by
ReubenBond
dpoornabi29088
asked this question in
Q&A
-
As you know we could resolve grains in Orleans 3.7.2 by the below code: var builder = WebApplication.CreateBuilder(args);
builder.Host.UseOrleans(static siloBuilder =>
{
siloBuilder
.Configure<ClusterOptions>(options =>
{
options.ClusterId = "dev";
options.ServiceId = "ServiceA";
})
**.ConfigureApplicationParts(parts => parts.AddApplicationPart(typeof(TestGrain).Assembly).WithReferences())**
.UseLocalhostClustering();
}); Where is "ConfigureApplicationParts" in Orleans 8.1? If removed, how can register grain in Silo and Client? public interface ITestGrain: IGrainWithStringKey
{
Task AddInstruction(int value);
Task<int> GetNextInstruction();
Task<int> GetInstructionCount();
Task<string> GetAllInstructions();
} public class TestGrain : Grain, ITestGrain
{
private Queue<int> instructions = new Queue<int>();
public Task AddInstruction(int value)
{
this.instructions.Enqueue(value);
return Task.CompletedTask;
}
public Task<int> GetInstructionCount()
{
return Task.FromResult(this.instructions.Count);
}
public Task<int> GetNextInstruction()
{
if (this.instructions.Count == 0)
{
return Task.FromResult<int>(0);
}
var instruction = this.instructions.Dequeue();
return Task.FromResult(instruction);
}
public Task<string> GetAllInstructions()
{
var instructions = string.Join(",", this.instructions);
return Task.FromResult(instructions);
}
} |
Beta Was this translation helpful? Give feedback.
Answered by
ReubenBond
May 25, 2024
Replies: 1 comment 3 replies
-
Application parts are gone. You don't need them anymore. Instead, just make sure that your silos and clients have the Microsoft.Orleans.Sdk package installed (it is included in the .Server and .Client packages) |
Beta Was this translation helpful? Give feedback.
3 replies
Answer selected by
dpoornabi29088
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Application parts are gone. You don't need them anymore. Instead, just make sure that your silos and clients have the Microsoft.Orleans.Sdk package installed (it is included in the .Server and .Client packages)