internal static ChannelFactory <TContract> CreateChannelFactory <TService, TContract>(Action <IServiceCollection> configure) where TService : class { var binding = new DispatcherBinding <TService, TContract>((services) => { configure?.Invoke(services); IServerAddressesFeature serverAddressesFeature = new ServerAddressesFeature(); serverAddressesFeature.Addresses.Add(new Uri(s_endpointAddress).GetLeftPart(UriPartial.Authority) + "/"); services.AddSingleton(serverAddressesFeature); }); return(new ChannelFactory <TContract>(binding, new EndpointAddress(s_endpointAddress))); }
internal static ChannelFactory <TContract> CreateChannelFactory <TService, TContract>(Action <IServiceCollection> configure, Action <CoreWCF.ServiceHostBase> configureServiceHostBase = default) where TService : class { var binding = new DispatcherBinding <TService, TContract>((services) => { configure?.Invoke(services); IServerAddressesFeature serverAddressesFeature = new ServerAddressesFeature(); serverAddressesFeature.Addresses.Add(new Uri(s_endpointAddress).GetLeftPart(UriPartial.Authority) + "/"); services.AddSingleton(serverAddressesFeature); services.AddSingleton(typeof(ILogger <>), typeof(NullLogger <>)); services.AddSingleton <IApplicationLifetime, ApplicationLifetime>(); }, configureServiceHostBase); return(new ChannelFactory <TContract>(binding, new EndpointAddress(s_endpointAddress))); }