Exemplo n.º 1
0
 private LinkBuilder(
     LinkBuilder prev,
     string connectionName            = null,
     Uri connectionString             = null,
     bool?autoStart                   = null,
     TimeSpan?timeout                 = null,
     TimeSpan?recoveryInterval        = null,
     ILinkLoggerFactory loggerFactory = null,
     string appId = null,
     LinkStateHandler <LinkConnectionState> stateHandler = null,
     bool?useBackgroundThreadsForConnection = null,
     ILinkSerializer serializer             = null
     ) : this(
         connectionName ?? prev._connectionName,
         connectionString ?? prev._connectionString,
         autoStart ?? prev._autoStart,
         timeout ?? prev._timeout,
         recoveryInterval ?? prev._recoveryInterval,
         loggerFactory ?? prev._loggerFactory,
         appId ?? prev._appId,
         stateHandler ?? prev._stateHandler,
         useBackgroundThreadsForConnection ?? prev._useBackgroundThreadsForConnection,
         serializer ?? prev._serializer
         )
 {
 }
Exemplo n.º 2
0
        public ILinkBuilder LoggerFactory(ILinkLoggerFactory value)
        {
            if (value == null)
            {
                throw new ArgumentNullException(nameof(value));
            }

            return(new LinkBuilder(this, loggerFactory: value));
        }
Exemplo n.º 3
0
        public LinkConfiguration(
            string connectionName,
            Uri connectionString,
            bool autoStart,
            TimeSpan timeout,
            TimeSpan recoveryInterval,
            ILinkLoggerFactory loggerFactory,
            string appId,
            LinkStateHandler <LinkConnectionState> stateHandler,
            bool useBackgroundThreadsForConnection,
            ILinkSerializer serializer
            )
        {
            if (string.IsNullOrWhiteSpace(connectionName))
            {
                throw new ArgumentNullException(nameof(connectionName));
            }

            if (timeout <= TimeSpan.Zero)
            {
                throw new ArgumentOutOfRangeException(nameof(timeout), "Must be greater than TimeSpan.Zero");
            }

            if (recoveryInterval <= TimeSpan.Zero)
            {
                throw new ArgumentOutOfRangeException(nameof(recoveryInterval), "Must be greater than TimeSpan.Zero");
            }

            if (string.IsNullOrWhiteSpace(appId))
            {
                throw new ArgumentNullException(nameof(appId));
            }

            ConnectionName   = connectionName.Trim();
            ConnectionString = connectionString ?? throw new ArgumentNullException(nameof(connectionString));
            AutoStart        = autoStart;
            Timeout          = timeout;
            RecoveryInterval = recoveryInterval;
            LoggerFactory    = loggerFactory ?? throw new ArgumentNullException(nameof(loggerFactory));
            AppId            = appId.Trim();
            StateHandler     = stateHandler ?? throw new ArgumentNullException(nameof(stateHandler));
            UseBackgroundThreadsForConnection = useBackgroundThreadsForConnection;
            Serializer = serializer;
        }
Exemplo n.º 4
0
 public LinkBuilder(
     string connectionName            = null,
     Uri connectionString             = null,
     bool?autoStart                   = null,
     TimeSpan?timeout                 = null,
     TimeSpan?recoveryInterval        = null,
     ILinkLoggerFactory loggerFactory = null,
     string appId = null,
     LinkStateHandler <LinkConnectionState> stateHandler = null,
     bool?useBackgroundThreadsForConnection = null,
     ILinkSerializer serializer             = null
     )
 {
     _connectionName   = connectionName ?? "default";
     _connectionString = connectionString;
     _autoStart        = autoStart ?? true;
     _timeout          = timeout ?? TimeSpan.FromSeconds(10);
     _recoveryInterval = recoveryInterval;
     _loggerFactory    = loggerFactory ?? new LinkNullLoggingFactory();
     _appId            = appId ?? Guid.NewGuid().ToString("D");
     _stateHandler     = stateHandler ?? ((old, @new) => { });
     _useBackgroundThreadsForConnection = useBackgroundThreadsForConnection ?? false;
     _serializer = serializer;
 }
 public ILinkConfigurationBuilder LoggerFactory(ILinkLoggerFactory value)
 {
     Configuration.LoggerFactory = value;
     return this;
 }