当前位置: 首页>>代码示例>>C#>>正文


C# ConnectionConfiguration.ThrowExceptions方法代码示例

本文整理汇总了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;
        }
开发者ID:konste,项目名称:serilog-sinks-elasticsearch,代码行数:45,代码来源:ElasticsearchSinkState.cs


注:本文中的ConnectionConfiguration.ThrowExceptions方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。