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

Add Generic version of EntityTypeConfiguration Attribute #30072

Closed
saivineeth100 opened this issue Jan 15, 2023 · 9 comments
Closed

Add Generic version of EntityTypeConfiguration Attribute #30072

saivineeth100 opened this issue Jan 15, 2023 · 9 comments
Labels
area-model-building closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. community-contribution customer-reported good first issue This issue should be relatively straightforward to fix. type-enhancement
Milestone

Comments

@saivineeth100
Copy link

Add generic arguments support for EntityTypeConfiguration attribute

From

[EntityTypeConfiguration(typeof(ModelConfiguration))]
    public class Model
    {.....}

To

[EntityTypeConfiguration<ModelConfiguration>()]
    public class Model
    {.....}
@ajcvickers ajcvickers added area-model-building good first issue This issue should be relatively straightforward to fix. labels Jan 19, 2023
@ajcvickers ajcvickers added this to the Backlog milestone Jan 19, 2023
@Marusyk
Copy link
Member

Marusyk commented Jan 22, 2023

Should we extend EntityTypeConfigurationEntityTypeAttributeConvention with the new EntityTypeConfigurationAttribute<T> or create a new one?

@ajcvickers
Copy link
Contributor

@Marusyk Probably extend, unless that doesn't work very well.

@joelmandell
Copy link

Is this one up for grabs?

@ajcvickers
Copy link
Contributor

@joelmandell Yes.

@amyboose
Copy link

amyboose commented Mar 16, 2023

Useful feature for DDD when parent class is generic Entity or AggregateEntity

@OsamaAbuSitta
Copy link
Contributor

OsamaAbuSitta commented Apr 2, 2023

In order to add generic constraint as the below should we move IEntityTypeConfiguration from EFCore to the abstraction project ,
since the type EntityTypeConfigurationAttribute exists in EFCore.Abstractions project , or we move the generic implementation to the EFCore project fix

where TEntity : IEntityTypeConfiguration

@ajcvickers ajcvickers removed this from the Backlog milestone Apr 4, 2023
@ajcvickers
Copy link
Contributor

@OsamaAbuSitta We will discuss. The problem is that IEntityTypeConfiguration has other dependencies that we cannot move. We may not be able to add a constraint to the generic argument.

@OsamaAbuSitta
Copy link
Contributor

@ajcvickers , In that case, should I proceed with submitting the pull request? for this changes commit

@ajcvickers
Copy link
Contributor

ajcvickers commented Apr 6, 2023

@OsamaAbuSitta We discussed this and we think its reasonable to put the generic version in the EntityFramework.Core assembly. (It was pointed out that in other to use this, there would already need to be a reference from the assembly containing the entity types to the assembly containing the configuration, which in turn must reference the main EF assembly, so we don't actually gain anything here by putting it in Abstractions.)

Also, leave the existing non-generic class where it is.

@ajcvickers ajcvickers added this to the Backlog milestone Apr 6, 2023
@ajcvickers ajcvickers added closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. community-contribution labels Apr 25, 2023
@ajcvickers ajcvickers modified the milestones: Backlog, 8.0.0-preview4 Apr 25, 2023
@ajcvickers ajcvickers modified the milestones: 8.0.0-preview4, 8.0.0 Nov 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-model-building closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. community-contribution customer-reported good first issue This issue should be relatively straightforward to fix. type-enhancement
Projects
None yet
Development

No branches or pull requests

6 participants