Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita295c6f

Browse files
authored
InMemoryTable: Make IsConcurrencyConflict() method more readable (#33561)
1 parent3163cb9 commita295c6f

File tree

1 file changed

+19
-16
lines changed

1 file changed

+19
-16
lines changed

‎src/EFCore.InMemory/Storage/Internal/InMemoryTable.cs‎

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -229,29 +229,32 @@ private static bool IsConcurrencyConflict(
229229
object?rowValue,
230230
Dictionary<IProperty,object?>concurrencyConflicts)
231231
{
232-
if(property.IsConcurrencyToken)
232+
if(!property.IsConcurrencyToken)
233233
{
234-
varcomparer=property.GetKeyValueComparer();
235-
varoriginalValue=entry.GetOriginalValue(property);
234+
returnfalse;
235+
}
236236

237-
varconverter=property.GetValueConverter()
238-
??property.FindTypeMapping()?.Converter;
237+
varcomparer=property.GetKeyValueComparer()
238+
??StructuralComparisons.StructuralEqualityComparer;
239239

240-
if(converter!=null)
241-
{
242-
rowValue=converter.ConvertFromProvider(rowValue);
243-
}
240+
varoriginalValue=entry.GetOriginalValue(property);
244241

245-
if((comparer!=null&&!comparer.Equals(rowValue,originalValue))
246-
||(comparer==null&&!StructuralComparisons.StructuralEqualityComparer.Equals(rowValue,originalValue)))
247-
{
248-
concurrencyConflicts.Add(property,rowValue);
242+
varconverter=property.GetValueConverter()
243+
??property.FindTypeMapping()?.Converter;
249244

250-
returntrue;
251-
}
245+
if(converter!=null)
246+
{
247+
rowValue=converter.ConvertFromProvider(rowValue);
252248
}
253249

254-
returnfalse;
250+
if(comparer.Equals(rowValue,originalValue))
251+
{
252+
returnfalse;
253+
}
254+
255+
concurrencyConflicts.Add(property,rowValue);
256+
257+
returntrue;
255258
}
256259

257260
/// <summary>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp