-
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
EntityTypeConfiguration annotation #23163 #23563
Conversation
src/EFCore/Metadata/Conventions/EntityConfigurationEntityTypeAttributeConvention.cs
Show resolved
Hide resolved
…sn't implement IEntityTypeConfiguration
@@ -67,6 +67,7 @@ public virtual ConventionSet CreateConventionSet() | |||
conventionSet.EntityTypeAddedConventions.Add(new NotMappedEntityTypeAttributeConvention(Dependencies)); | |||
conventionSet.EntityTypeAddedConventions.Add(new OwnedEntityTypeAttributeConvention(Dependencies)); | |||
conventionSet.EntityTypeAddedConventions.Add(new KeylessEntityTypeAttributeConvention(Dependencies)); | |||
conventionSet.EntityTypeAddedConventions.Add(new EntityConfigurationEntityTypeAttributeConvention(Dependencies)); |
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.
question: Does adding this one means this convention will always run making model building slower for everyone? If that's the case, is it worth it making it a pay per play scenario?
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.
Yes, we'll do it as part of #214
Thanks for your contribution! |
|
||
private object GetEntityBuilderInstance(IConventionEntityType conventionEntityType, Type entityTypeConfiguration) | ||
{ | ||
Type[] entityTypeArgs = GetEntityTypeArgs(entityTypeConfiguration); |
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.
Style guide 😢
|
||
Type constructed = entityTypeBuilder.MakeGenericType(entityTypeArgs); | ||
|
||
var entityTypeBuilderInstance = Activator.CreateInstance(constructed, new object[] { conventionEntityType }); |
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.
Shouldn't we verify some sort of clr type match?
For an entityType of "Blog", we cannot really use IEntityTypeConfiguration<Post>
Fixes #23163
I am not sure how I have to handle the case when in the attribute a wrong Configuration type is given