Skip to content

Commit a1dc376

Browse files
committed
Additional checks for founded field to make sure it is correct
1 parent ee8b0f2 commit a1dc376

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

Orm/Xtensive.Orm/Orm/Providers/Requests/PersistRequestBuilder.cs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
// Copyright (C) 2003-2010 Xtensive LLC.
2-
// All rights reserved.
3-
// For conditions of distribution and use, see license.
1+
// Copyright (C) 2008-2021 Xtensive LLC.
2+
// This code is distributed under MIT license terms.
3+
// See the License.txt file in the project root for more information.
44
// Created by: Dmitri Maximov
55
// Created: 2008.08.28
66

@@ -232,8 +232,10 @@ private ParameterTransmissionType GetTransmissionType(TableColumn column)
232232

233233
private static int GetFieldIndex(TypeInfo type, ColumnInfo column)
234234
{
235-
FieldInfo field;
236-
if (!type.Fields.TryGetValue(column.Field.Name, out field))
235+
if (!type.Fields.TryGetValue(column.Field.Name, out var field)
236+
|| field.Column == null
237+
|| field.Column.ValueType != column.ValueType
238+
|| field.Column.Name != column.Name)
237239
return -1;
238240
return field.MappingInfo.Offset;
239241
}

0 commit comments

Comments
 (0)