Пример #1
0
        private static IEnumerable <ServiceEndpoint> GetEndpoints(IServiceEndpointOptions options)
        {
            if (options == null)
            {
                yield break;
            }

            var endpoints        = options.Endpoints;
            var connectionString = options.ConnectionString;

            // ConnectionString can be set by custom Csonfigure
            // Return both the one from ConnectionString and from Endpoints
            // TODO: Better way if Endpoints already contains ConnectionString one?
            if (!string.IsNullOrEmpty(connectionString))
            {
                yield return(new ServiceEndpoint(options.ConnectionString));
            }

            if (endpoints != null)
            {
                foreach (var endpoint in endpoints)
                {
                    yield return(endpoint);
                }
            }
        }
Пример #2
0
        protected static IEnumerable <ServiceEndpoint> GetEndpoints(IServiceEndpointOptions options)
        {
            if (options == null)
            {
                yield break;
            }

            var endpoints        = options.Endpoints;
            var connectionString = options.ConnectionString;

            if (!string.IsNullOrEmpty(connectionString))
            {
                yield return(new ServiceEndpoint(options.ConnectionString));
            }

            // ConnectionString can be set by custom Configure
            // Return both the one from ConnectionString and from Endpoints
            if (endpoints != null)
            {
                foreach (var endpoint in endpoints)
                {
                    yield return(endpoint);
                }
            }
        }
Пример #3
0
        private static IEnumerable <ServiceEndpoint> GetEndpoints(IServiceEndpointOptions options)
        {
            if (options == null)
            {
                yield break;
            }

            var endpoints        = options.Endpoints;
            var connectionString = options.ConnectionString;

            // ConnectionString can be set by custom Configure
            // Return both the one from ConnectionString and from Endpoints
            // when the one from connectionString is not included in Endpoints
            var connectionStringIncluded = false;

            if (endpoints != null)
            {
                foreach (var endpoint in endpoints)
                {
                    if (endpoint.ConnectionString == connectionString)
                    {
                        connectionStringIncluded = true;
                    }

                    yield return(endpoint);
                }
            }

            if (!string.IsNullOrEmpty(connectionString) && !connectionStringIncluded)
            {
                yield return(new ServiceEndpoint(options.ConnectionString));
            }
        }
 public ServiceConnectionContainerFactory(
     IServiceConnectionFactory serviceConnectionFactory,
     IServiceEndpointManager serviceEndpointManager,
     IMessageRouter router,
     IServiceEndpointOptions options,
     ILoggerFactory loggerFactory)
 {
     _serviceConnectionFactory = serviceConnectionFactory;
     _serviceEndpointManager   = serviceEndpointManager ?? throw new ArgumentNullException(nameof(serviceEndpointManager));
     _router        = router ?? throw new ArgumentNullException(nameof(router));
     _options       = options;
     _loggerFactory = loggerFactory;
 }
Пример #5
0
 public ServiceConnectionContainerFactory(
     IServiceConnectionFactory serviceConnectionFactory,
     IServiceEndpointManager serviceEndpointManager,
     IMessageRouter router,
     IServiceEndpointOptions options,
     IServerNameProvider nameProvider,
     IClientConnectionLifetimeManager lifetime,
     ILoggerFactory loggerFactory)
 {
     _serviceConnectionFactory = serviceConnectionFactory;
     _serviceEndpointManager   = serviceEndpointManager ?? throw new ArgumentNullException(nameof(serviceEndpointManager));
     _router        = router ?? throw new ArgumentNullException(nameof(router));
     _options       = options;
     _nameProvider  = nameProvider;
     _lifetime      = lifetime;
     _loggerFactory = loggerFactory;
 }
Пример #6
0
 protected ServiceEndpointManagerBase(IServiceEndpointOptions options, ILogger logger)
     : this(GetEndpoints(options), logger)
 {
 }
Пример #7
0
 protected ServiceEndpointManagerBase(IServiceEndpointOptions options, ILogger logger)
     : this(ServiceEndpointUtility.Merge(options.ConnectionString, options.Endpoints), logger)
 {
 }
Пример #8
0
 protected ServiceEndpointManagerBase(IServiceEndpointOptions options, ILogger logger)
     : this(options.GetMergedEndpoints(), logger)
 {
 }
Пример #9
0
 public ServiceEndpointManagerBase(IServiceEndpointOptions options, ILogger logger)
     : this(GetEndpoints(options).ToArray(), logger)
 {
 }