コード例 #1
0
ファイル: ElasticMapping.cs プロジェクト: tecan/ElasticLINQ
 /// <summary>
 /// Initializes a new instance of the <see cref="ElasticMapping"/> class.
 /// </summary>
 /// <param name="connection">The information on how to connect to the Elasticsearch server.</param>
 /// <param name="log">The object which logs information (optional, defaults to <see cref="NullLog"/>).</param>
 /// <param name="camelCaseFieldNames">Pass <c>true</c> to automatically camel-case field names (for <see cref="GetFieldName(Type, MemberInfo)"/>).</param>
 /// <param name="pluralizeTypeNames">Pass <c>true</c> to automatically pluralize type names (for <see cref="GetIndexType"/>).</param>
 /// <param name="lowerCaseAnalyzedFieldValues">Pass <c>true</c> to automatically convert field values to lower case (for <see cref="FormatValue"/>).</param>
 /// <param name="enumFormat">Pass <c>EnumFormat.String</c> to format enums as strings or <c>EnumFormat.Integer</c> to use integers (defaults to string).</param>
 /// <param name="conversionCulture">The culture to use for the lower-casing, camel-casing, and pluralization operations. If <c>null</c>,
 /// uses <see cref="CultureInfo.CurrentCulture"/>.</param>
 public ElasticMapping(IElasticConnection connection,
                       ILog log,
                       bool camelCaseFieldNames          = true,
                       bool pluralizeTypeNames           = true,
                       bool lowerCaseAnalyzedFieldValues = true,
                       EnumFormat enumFormat             = EnumFormat.String,
                       CultureInfo conversionCulture     = null)
 {
     this._camelCaseFieldNames          = camelCaseFieldNames;
     this._pluralizeTypeNames           = pluralizeTypeNames;
     this._lowerCaseAnalyzedFieldValues = lowerCaseAnalyzedFieldValues;
     this._conversionCulture            = conversionCulture ?? CultureInfo.CurrentCulture;
     this._enumFormat         = enumFormat;
     _elasticPropertyMappings = new Lazy <IDictionary <string, string> >(() =>
     {
         return(connection.GetPropertiesMappings(log).Result);
     });
 }