Skip to content

Commit efab5fd

Browse files
CopilotAndriySvyryd
andcommitted
Use pattern matching for AnnotatableBase condition in ToDebugString methods
Co-authored-by: AndriySvyryd <[email protected]>
1 parent b490e60 commit efab5fd

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

src/EFCore/Metadata/IReadOnlyComplexProperty.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ string ToDebugString(MetadataDebugStringOptions options = MetadataDebugStringOpt
9191
}
9292

9393
if ((options & MetadataDebugStringOptions.IncludePropertyIndexes) != 0
94-
&& (this is RuntimeAnnotatableBase || (this is AnnotatableBase annotatable && annotatable.IsReadOnly)))
94+
&& (this is RuntimeAnnotatableBase || this is AnnotatableBase { IsReadOnly: true }))
9595
{
9696
var indexes = ((IProperty)this).GetPropertyIndexes();
9797
builder.Append(' ').Append(indexes.Index);

src/EFCore/Metadata/IReadOnlyNavigation.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ string ToDebugString(MetadataDebugStringOptions options = MetadataDebugStringOpt
165165
}
166166

167167
if ((options & MetadataDebugStringOptions.IncludePropertyIndexes) != 0
168-
&& (this is RuntimeAnnotatableBase || (this is AnnotatableBase annotatable && annotatable.IsReadOnly)))
168+
&& (this is RuntimeAnnotatableBase || this is AnnotatableBase { IsReadOnly: true }))
169169
{
170170
var indexes = ((INavigation)this).GetPropertyIndexes();
171171
builder.Append(' ').Append(indexes.Index);

src/EFCore/Metadata/IReadOnlyProperty.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ string ToDebugString(MetadataDebugStringOptions options = MetadataDebugStringOpt
433433
}
434434

435435
if ((options & MetadataDebugStringOptions.IncludePropertyIndexes) != 0
436-
&& (this is RuntimeAnnotatableBase || (this is AnnotatableBase annotatable && annotatable.IsReadOnly)))
436+
&& (this is RuntimeAnnotatableBase || this is AnnotatableBase { IsReadOnly: true }))
437437
{
438438
var indexes = ((IProperty)this).GetPropertyIndexes();
439439
builder.Append(' ').Append(indexes.Index);

src/EFCore/Metadata/IReadOnlySkipNavigation.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ string ToDebugString(MetadataDebugStringOptions options = MetadataDebugStringOpt
9999
}
100100

101101
if ((options & MetadataDebugStringOptions.IncludePropertyIndexes) != 0
102-
&& (this is RuntimeAnnotatableBase || (this is AnnotatableBase annotatable && annotatable.IsReadOnly)))
102+
&& (this is RuntimeAnnotatableBase || this is AnnotatableBase { IsReadOnly: true }))
103103
{
104104
var indexes = ((ISkipNavigation)this).GetPropertyIndexes();
105105
builder.Append(' ').Append(indexes.Index);

0 commit comments

Comments
 (0)