本文整理汇总了C#中ConnectionConfiguration.ThrowExceptions方法的典型用法代码示例。如果您正苦于以下问题:C# ConnectionConfiguration.ThrowExceptions方法的具体用法?C# ConnectionConfiguration.ThrowExceptions怎么用?C# ConnectionConfiguration.ThrowExceptions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConnectionConfiguration
的用法示例。
在下文中一共展示了ConnectionConfiguration.ThrowExceptions方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ElasticsearchSinkState
private ElasticsearchSinkState(ElasticsearchSinkOptions options)
{
if (string.IsNullOrWhiteSpace(options.IndexFormat)) throw new ArgumentException("options.IndexFormat");
if (string.IsNullOrWhiteSpace(options.TypeName)) throw new ArgumentException("options.TypeName");
if (string.IsNullOrWhiteSpace(options.TemplateName)) throw new ArgumentException("options.TemplateName");
this._templateName = options.TemplateName;
this._templateMatchString = IndexFormatRegex.Replace(options.IndexFormat, @"$1*$2");
_indexDecider = options.IndexDecider ?? ((@event, offset) => string.Format(options.IndexFormat, offset));
_typeName = options.TypeName;
_options = options;
Func<ConnectionConfiguration, IElasticsearchSerializer> serializerFactory = null;
if (options.Serializer != null)
{
serializerFactory = s => options.Serializer;
}
ConnectionConfiguration configuration = new ConnectionConfiguration(options.ConnectionPool, options.Connection, serializerFactory)
.RequestTimeout(options.ConnectionTimeout);
if (options.ModifyConnectionSettings != null)
configuration = options.ModifyConnectionSettings(configuration);
configuration.ThrowExceptions();
_client = new ElasticLowLevelClient(configuration);
_formatter = options.CustomFormatter ?? new ElasticsearchJsonFormatter(
formatProvider: options.FormatProvider,
renderMessage: true,
closingDelimiter: string.Empty,
serializer: options.Serializer,
inlineFields: options.InlineFields
);
_durableFormatter = options.CustomDurableFormatter ?? new ElasticsearchJsonFormatter(
formatProvider: options.FormatProvider,
renderMessage: true,
closingDelimiter: Environment.NewLine,
serializer: options.Serializer,
inlineFields: options.InlineFields
);
_registerTemplateOnStartup = options.AutoRegisterTemplate;
}