Exemple #1
0
 public static void AddScopedOrleansClusterClient(this IServiceCollection services, OrleansConfig config)
 {
     services.AddScoped(serviceProvider =>
     {
         var builder = new ClientBuilder();
         builder.AddOrleansClusterClient(config);
         IClusterClient client = builder.Build();
         client.Connect(CreateRetryFilter()).GetAwaiter().GetResult();
         return(client);
     });
 }
Exemple #2
0
        public static void AddSingletonOrleansClusterClient(this IServiceCollection services, OrleansConfig config)
        {
            services.AddSingleton(serviceProvider =>
            {
                var builder = new ClientBuilder();
                if (!string.IsNullOrEmpty(config.InstrumentationKey))
                {
                    builder.AddApplicationInsightsTelemetryConsumer(config.InstrumentationKey);
                }

                builder.AddOrleansClusterClient(config);
                IClusterClient client = builder.Build();
                client.Connect(CreateRetryFilter()).GetAwaiter().GetResult();
                return(client);
            });
        }