Skip to content

Commit 6fd81dc

Browse files
author
Christian Käser
committed
Use correct CLR types for fields with value converters
1 parent 035c941 commit 6fd81dc

File tree

5 files changed

+5
-5
lines changed

5 files changed

+5
-5
lines changed

FileContextCore/Serializer/BSONSerializer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public BSONSerializer(IEntityType _entityType)
2020
{
2121
entityType = _entityType;
2222
propertyKeys = entityType.GetProperties().Select(p => p.Relational().ColumnName).ToArray();
23-
typeList = entityType.GetProperties().Select(p => p.ClrType).ToArray();
23+
typeList = entityType.GetProperties().Select(p => p.GetValueConverter()?.ProviderClrType ?? p.ClrType).ToArray();
2424
}
2525

2626
public Dictionary<TKey, object[]> Deserialize<TKey>(string list, Dictionary<TKey, object[]> newList)

FileContextCore/Serializer/CSVSerializer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public CSVSerializer(IEntityType _entityType)
1919
{
2020
entityType = _entityType;
2121
propertyKeys = entityType.GetProperties().Select(p => p.Relational().ColumnName).ToArray();
22-
typeList = entityType.GetProperties().Select(p => p.ClrType).ToArray();
22+
typeList = entityType.GetProperties().Select(p => p.GetValueConverter()?.ProviderClrType ?? p.ClrType).ToArray();
2323
}
2424

2525
public Dictionary<TKey, object[]> Deserialize<TKey>(string list, Dictionary<TKey, object[]> newList)

FileContextCore/Serializer/EXCELSerializer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public EXCELSerializer(IEntityType _entityType, string _password, string databas
3838
{
3939
entityType = _entityType;
4040
propertyKeys = entityType.GetProperties().Select(p => p.Relational().ColumnName).ToArray();
41-
typeList = entityType.GetProperties().Select(p => p.ClrType).ToArray();
41+
typeList = entityType.GetProperties().Select(p => p.GetValueConverter()?.ProviderClrType ?? p.ClrType).ToArray();
4242
password = _password;
4343
this.databaseName = databaseName;
4444

FileContextCore/Serializer/JSONSerializer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public JSONSerializer(IEntityType _entityType)
1717
{
1818
entityType = _entityType;
1919
propertyKeys = entityType.GetProperties().Select(p => p.Relational().ColumnName).ToArray();
20-
typeList = entityType.GetProperties().Select(p => p.ClrType).ToArray();
20+
typeList = entityType.GetProperties().Select(p => p.GetValueConverter()?.ProviderClrType ?? p.ClrType).ToArray();
2121
}
2222

2323
public Dictionary<TKey, object[]> Deserialize<TKey>(string list, Dictionary<TKey, object[]> newList)

FileContextCore/Serializer/XMLSerializer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public XMLSerializer(IEntityType _entityType)
2121
{
2222
entityType = _entityType;
2323
propertyKeys = entityType.GetProperties().Select(p => p.Relational().ColumnName).ToArray();
24-
typeList = entityType.GetProperties().Select(p => p.ClrType).ToArray();
24+
typeList = entityType.GetProperties().Select(p => p.GetValueConverter()?.ProviderClrType ?? p.ClrType).ToArray();
2525
}
2626

2727
public Dictionary<TKey, object[]> Deserialize<TKey>(string list, Dictionary<TKey, object[]> newList)

0 commit comments

Comments
 (0)