-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Further improve model building performance #11526
Conversation
5db649a
to
d00ba59
Compare
@@ -183,27 +177,25 @@ public virtual bool Apply(InternalEntityTypeBuilder entityTypeBuilder, EntityTyp | |||
public virtual bool Apply(InternalEntityTypeBuilder entityTypeBuilder, string ignoredMemberName) | |||
{ | |||
var navigationPropertyInfo = | |||
entityTypeBuilder.Metadata.ClrType.GetRuntimeProperties().FirstOrDefault(p => p.Name == ignoredMemberName); | |||
entityTypeBuilder.Metadata.GetRuntimeProperties()?.Find(ignoredMemberName); | |||
if (navigationPropertyInfo == null) | |||
{ | |||
return true; | |||
} | |||
|
|||
var targetClrType = FindCandidateNavigationPropertyType(navigationPropertyInfo); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could DRY this with if condition in a private function
if (clrProperties.Count > 0) | ||
foreach (var clrProperty in clrProperties) | ||
{ | ||
var actualProperty = entityType.GetRuntimeProperties().Find(clrProperty); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need Find
here since it was First
earlier? Direct key access?
Memoize DisplayName() for Type Call Attribute.IsDefined before GetCustomAttributes() Use in parameters for TypeMappingInfo and RelationalTypeMappingInfo Implement IEquatable<T> on TypeMappingInfo and RelationalTypeMappingInfo Fixes #9347
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cache property and field infos
Memoize DisplayName() for Type
Call Attribute.IsDefined before GetCustomAttributes()
Use in parameters for TypeMappingInfo and RelationalTypeMappingInfo
Implement IEquatable on TypeMappingInfo and RelationalTypeMappingInfo
Fixes #9347