Skip to content

Sugar for HasForeignKey/HasPrincipalKey #6003

New issue

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

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 1 commit into from
Jul 8, 2016
Merged

Sugar for HasForeignKey/HasPrincipalKey #6003

merged 1 commit into from
Jul 8, 2016

Conversation

ajcvickers
Copy link
Contributor

Issue #5377

Added back generic overloads so that in the common case of a shadow property in CLR entity types the generic method can be used instead of using typeof().

Also, only for these APIs, the short name of the type can be passed as a string since the resolution space is very small--it just checks the name at either end of the relationship.

/// The name(s) of the foreign key property(s).
/// </param>
/// <returns> The same builder instance so that multiple configuration calls can be chained. </returns>
public virtual ReferenceReferenceBuilder HasForeignKey<TDependentEntity>(
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this have a class constraint to match the other APIs in CF?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will do.

@anpete
Copy link
Contributor

anpete commented Jul 7, 2016

:shipit:

@@ -314,9 +314,15 @@ public GenericTestReferenceReferenceBuilder(ReferenceReferenceBuilder<TEntity, T
public override TestReferenceReferenceBuilder<TEntity, TRelatedEntity> HasForeignKey(Type dependentEntityType, params string[] foreignKeyPropertyNames)
Copy link
Member

Choose a reason for hiding this comment

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

The Type overload should be removed from base. The current implementation would become the implementation of the new overload in ModelBuilderNonGenericTest

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will do.

@ajcvickers
Copy link
Contributor Author

@AndriySvyryd Pushed an update.

@AndriySvyryd
Copy link
Member

:shipit:

Issue #5377

Added back generic overloads so that in the common case of a shadow property in CLR entity types the generic method can be used instead of using typeof().

Also, only for these APIs, the short name of the type can be passed as a string since the resolution space is very small--it just checks the name at either end of the relationship.
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants