Example #1
0
        private string ResolveMemberInfo(MemberInfo info)
        {
            if (info == null)
            {
                return(null);
            }

            var name = info.Name;

            IPropertyMapping propertyMapping = null;

            if (this._settings.PropertyMappings.TryGetValue(info, out propertyMapping))
            {
                return(propertyMapping.Name);
            }

            var att = ElasticsearchPropertyAttribute.From(info);

            if (att != null && !att.Name.IsNullOrEmpty())
            {
                return(att.Name);
            }

            return(_settings.Serializer?.CreatePropertyName(info) ?? _settings.DefaultFieldNameInferrer(name));
        }
Example #2
0
        public string Resolve(MemberInfo info)
        {
            if (info == null)
            {
                return(null);
            }

            var name = info.Name;

            var att = ElasticsearchPropertyAttribute.From(info);

            if (att != null && !att.Name.IsNullOrEmpty())
            {
                return(att.Name);
            }

            return(_settings.DefaultFieldNameInferrer(name));
        }
Example #3
0
            public string Resolve(MemberInfo info)
            {
                if (info == null)
                {
                    return(null);
                }

                var name = info.Name;

                if (this._settings.PropertyMappings.TryGetValue(info, out IPropertyMapping propertyMapping))
                {
                    return(propertyMapping.Name);
                }

                var att = ElasticsearchPropertyAttributeBase.From(info);

                if (att != null && !string.IsNullOrEmpty(att.Name))
                {
                    return(att.Name);
                }

                return(_settings.PropertyMappingProvider?.CreatePropertyMapping(info)?.Name ?? _settings.DefaultFieldNameInferrer(name));
            }