Пример #1
0
        public MssqlStorage(IOptions <MssqlStorageOptions> options)
        {
            _options = options?.Value ?? throw new ArgumentNullException(nameof(MssqlStorageOptions));

            if (string.IsNullOrEmpty(_options.HangfireDb))
            {
                throw new ArgumentNullException(nameof(MssqlStorageOptions.HangfireDb));
            }

            if (string.IsNullOrEmpty(_options.TablePrefix))
            {
                throw new ArgumentNullException(nameof(MssqlStorageOptions.TablePrefix));
            }
        }
        public MssqlStorage(MssqlStorageOptions options)
        {
            _options = options ?? throw new ArgumentNullException(nameof(MssqlStorageOptions));
            if (_options.ExpireAtDays <= 0)
            {
                _options.ExpireAtDays = 7;
            }
            if (string.IsNullOrEmpty(_options.HangfireDb))
            {
                throw new ArgumentNullException(nameof(MssqlStorageOptions.HangfireDb));
            }

            if (string.IsNullOrEmpty(_options.TablePrefix))
            {
                throw new ArgumentNullException(nameof(MssqlStorageOptions.TablePrefix));
            }
        }