Skip to content
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

Merged
merged 1 commit into from
Apr 4, 2018
Merged

Further improve model building performance #11526

merged 1 commit into from
Apr 4, 2018

Conversation

AndriySvyryd
Copy link
Member

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

@AndriySvyryd AndriySvyryd requested a review from smitpatel April 2, 2018 23:17
@AndriySvyryd AndriySvyryd force-pushed the Issue9347 branch 2 times, most recently from 5db649a to d00ba59 Compare April 4, 2018 01:27
@@ -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);
Copy link
Contributor

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);
Copy link
Contributor

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
Copy link
Contributor

@smitpatel smitpatel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@AndriySvyryd AndriySvyryd merged commit adbb2b3 into dev Apr 4, 2018
@AndriySvyryd AndriySvyryd deleted the Issue9347 branch April 4, 2018 21:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants