/// <summary> /// Adds a service fabric service remoting proxy to the IServiceCollection /// </summary> /// <typeparam name="TService"></typeparam> /// <param name="services"></param> /// <param name="serviceUri"></param> /// <returns></returns> public static IServiceCollection AddServiceFabricService <TService>( this IServiceCollection services, string serviceUri) where TService : class, IService { services.AddSingleton( provider => ServiceHostProxy.Create <TService>( new Uri(serviceUri), provider.GetRequiredService <TelemetryClient>(), provider.GetRequiredService <ServiceContext>())); return(services); }
/// <summary> /// Adds a service fabric service remoting proxy to the ContainerBuilder /// </summary> /// <typeparam name="TService"></typeparam> /// <param name="builder"></param> /// <param name="serviceUri"></param> /// <returns></returns> public static ContainerBuilder AddServiceFabricService <TService>( this ContainerBuilder builder, string serviceUri) where TService : class, IService { builder.Register( c => ServiceHostProxy.Create <TService>( new Uri(serviceUri), c.Resolve <TelemetryClient>(), c.Resolve <ServiceContext>())); return(builder); }