protected override void Validate() { if (ConnectionString == null) { throw new ArgumentNullException(nameof(ConnectionString)); } if (ConnectionString.Length == 0) { throw new ArgumentException("连接字符串{0}不能为空".With(nameof(ConnectionString)), nameof(ConnectionString)); } LogstashUri.For(ConnectionString).Validate(); if (MaxConcurrent == 0) { throw new ArgumentOutOfRangeException(nameof(MaxConcurrent), "最大并发数必须大于0"); } }
public static ILogRepository Create(string connectionString, int maxConcurrent) { return(new CLogRepository(LogstashUri.For(connectionString), new RestHttpClientHelper())); }