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

InMemoryTable: Make IsConcurrencyConflict() method more readable#33561

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
ajcvickers merged 1 commit intodotnet:mainfromy0ung3r:main
Apr 21, 2024
Merged
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
InMemoryTable: Make IsConcurrencyConflict() method more readable
  • Loading branch information
@y0ung3r
y0ung3r committedApr 18, 2024
commitd474f9ae7f615102f4f8141f2d5f6a27034bd337
35 changes: 19 additions & 16 deletionssrc/EFCore.InMemory/Storage/Internal/InMemoryTable.cs
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -229,29 +229,32 @@ private static bool IsConcurrencyConflict(
object? rowValue,
Dictionary<IProperty, object?> concurrencyConflicts)
{
if (property.IsConcurrencyToken)
if (!property.IsConcurrencyToken)
{
var comparer = property.GetKeyValueComparer();
var originalValue = entry.GetOriginalValue(property);
return false;
}

varconverter = property.GetValueConverter()
??property.FindTypeMapping()?.Converter;
varcomparer = property.GetKeyValueComparer()
??StructuralComparisons.StructuralEqualityComparer;

if (converter != null)
{
rowValue = converter.ConvertFromProvider(rowValue);
}
var originalValue = entry.GetOriginalValue(property);

if ((comparer != null && !comparer.Equals(rowValue, originalValue))
|| (comparer == null && !StructuralComparisons.StructuralEqualityComparer.Equals(rowValue, originalValue)))
{
concurrencyConflicts.Add(property, rowValue);
var converter = property.GetValueConverter()
?? property.FindTypeMapping()?.Converter;

return true;
}
if (converter != null)
{
rowValue = converter.ConvertFromProvider(rowValue);
}

return false;
if (comparer.Equals(rowValue, originalValue))
{
return false;
}

concurrencyConflicts.Add(property, rowValue);

return true;
}

/// <summary>
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp