Skip to content

Commit 9ac0733

Browse files
Cleanup property mapping types (#6388) (#6389)
* Cleanup the property mapping types * Update target framework for JsonNetSerializer * Rename type * Update compiler directives * Add equals and gethashcode to PropertyMapping * Make PropertyMapping readonly * Finish PropertyMapping * Fix BOM Co-authored-by: Steve Gordon <sgordon@hotmail.co.uk>
1 parent ce1c37f commit 9ac0733

19 files changed

+530
-130
lines changed

src/Elastic.Clients.Elasticsearch.JsonNetSerializer/ConnectionSettingsAwareSerializerBase.PropertyMappingProvider.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,15 @@ private static PropertyMapping FromAttributes(MemberInfo memberInfo)
2828
{
2929
var jsonProperty = memberInfo.GetCustomAttribute<JsonPropertyAttribute>(true);
3030
var dataMemberProperty = memberInfo.GetCustomAttribute<DataMemberAttribute>(true);
31-
//var propertyName = memberInfo.GetCustomAttribute<PropertyNameAttribute>(true);
32-
var ignore = memberInfo.GetCustomAttribute<IgnoreAttribute>(true);
3331
var jsonIgnore = memberInfo.GetCustomAttribute<JsonIgnoreAttribute>(true);
3432

35-
if (jsonProperty == null && ignore == null /*&& propertyName == null*/ && dataMemberProperty == null && jsonIgnore == null) return null;
33+
if (jsonProperty is null && dataMemberProperty is null && jsonIgnore is null) return default;
3634

3735
return new PropertyMapping
38-
{ Name = /*propertyName?.Name ??*/ jsonProperty?.PropertyName ?? dataMemberProperty?.Name, Ignore = ignore != null || jsonIgnore != null };
36+
{
37+
Name = jsonProperty?.PropertyName ?? dataMemberProperty?.Name,
38+
Ignore = jsonIgnore != null
39+
};
3940
}
4041
}
4142
}

src/Elastic.Clients.Elasticsearch.JsonNetSerializer/Elastic.Clients.Elasticsearch.JsonNetSerializer.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<PropertyGroup>
1111
<IsPackable>true</IsPackable>
1212
<GenerateDocumentationFile>true</GenerateDocumentationFile>
13-
<TargetFrameworks>netstandard2.0;net461</TargetFrameworks>
13+
<TargetFrameworks>netstandard2.0;net461;netstandard2.1;netcoreapp3.1;net5.0;net6.0</TargetFrameworks>
1414
</PropertyGroup>
1515
<ItemGroup>
1616
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />

0 commit comments

Comments
 (0)