public async Task DemoRun() { var builder = OrleansClientBuilder .CreateLocalhostClientBuilder(clusterId: "dev", serviceId: "HelloWorldApp"); builder .ConfigureApplicationParts(parts => parts.AddApplicationPart(typeof(IHello).Assembly).WithCodeGeneration()) .ConfigureLogging(logBuilder => { logBuilder.AddSerilog(); }); using (var client = builder.Build()) { await client.ConnectWithRetryAsync(); _logger.LogInformation("Client successfully connect to silo host"); var grain = client.GetGrain <IHello>(0); _logger.LogInformation("Get hello world grain, start calling RPC methods..."); var returnValue = await grain.SayHello("Hello Orleans"); _logger.LogInformation($"RPC method return value is \r\n\r\n{{{returnValue}}}\r\n"); await client.Close(); _logger.LogInformation("Client successfully close connection to silo host"); } }
public static IClientBuilder CreateOrleansClientBuilder( int gatewayPort = 30000, string clusterId = "dev", string serviceId = "dev", IEnumerable <Type> applicationPartTypes = null) { var builder = OrleansClientBuilder .CreateLocalhostClientBuilder(gatewayPort, clusterId, serviceId, applicationPartTypes) .ConfigureApplicationParts(_ => _.AddApplicationPart(typeof(IHello).Assembly).WithCodeGeneration()); return(builder); }