Example #1
0
        private static async Task <ISiloHost> StartSilo()
        {
            var assambly = typeof(IHelloGrain).Assembly;
            var builder  = new SiloHostBuilder()
                           .UseLocalhostClustering()
                           .Configure <ClusterOptions>(options =>
            {
                options.ClusterId = "dev";
                options.ServiceId = "TestApp";
            })
                           .Configure <EndpointOptions>(options => options.AdvertisedIPAddress = IPAddress.Loopback)
                           .ConfigureApplicationParts(parts => parts.AddApplicationPart(assambly).WithReferences())
                           .ConfigureLogging(logging => logging.AddConsole())
                           .UseInMemoryReminderService()
                           .UseLocalhostClustering();

            //Silo内每个方法都会触发 前触发
            builder.AddIncomingGrainCallFilter <LoggingCallFilter>();

            var host = builder.Build();
            await host.StartAsync();

            return(host);
        }