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

EntityTypeConfiguration annotation #23163 #23563

Merged
merged 3 commits into from
Dec 8, 2020

Conversation

KaloyanIT
Copy link
Contributor

Fixes #23163

I am not sure how I have to handle the case when in the attribute a wrong Configuration type is given

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

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?

Copy link
Member

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

@AndriySvyryd AndriySvyryd merged commit e1b9366 into dotnet:main Dec 8, 2020
@AndriySvyryd
Copy link
Member

Thanks for your contribution!


private object GetEntityBuilderInstance(IConventionEntityType conventionEntityType, Type entityTypeConfiguration)
{
Type[] entityTypeArgs = GetEntityTypeArgs(entityTypeConfiguration);
Copy link
Contributor

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

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>

AndriySvyryd added a commit that referenced this pull request Dec 8, 2020
AndriySvyryd added a commit that referenced this pull request Dec 8, 2020
AndriySvyryd added a commit that referenced this pull request Dec 8, 2020
AndriySvyryd added a commit that referenced this pull request Dec 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

EntityTypeConfiguration annotation
5 participants