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

Metadata: Allow indexes and foreign keys to use inherited properties #2514

Closed
AndriySvyryd opened this issue Jul 1, 2015 · 8 comments
Closed
Assignees
Labels
closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-enhancement
Milestone

Comments

@AndriySvyryd
Copy link
Member

The ModelBuilder should lift the FK or index when there is one declared on the same properties on a derived type

@rowanmiller
Copy link
Contributor

@AndriySvyryd if you don't think this is critical for 7.0.0 then come discuss as we may postpone it

@AndriySvyryd
Copy link
Member Author

7.0.0 and pri0 are appropriate for this

@rowanmiller rowanmiller removed this from the 7.0.0 milestone Sep 17, 2015
@rowanmiller
Copy link
Contributor

@AndriySvyryd can you add some more details on what this means?

@AndriySvyryd
Copy link
Member Author

Consider

class Base
{
  public int Id { get; set; }
}
class Derived : Base
{
  public string Name { get; set; }
}

You should be able to create an index like this:

modelBuilder.Entity<Derived>().Index(b => new [] { b.Id, b.Name });

Also if you had created an index on the derived entity type:

  modelBuilder.Entity<Derived>().Index(b => new [] { b.Id });

You should be able to override it on base:

  modelBuilder.Entity<Base>().Index(b => new [] { b.Id });

and viceversa.
Same applies to FKs.

@rowanmiller rowanmiller added this to the 7.0.0-rc1 milestone Sep 18, 2015
@rowanmiller
Copy link
Contributor

@AndriySvyryd can you discuss with folks what we want to do before doing it. Either design meeting, or just in the team room.

@smitpatel
Copy link
Contributor

Partially implementing this for indexes alongwith #700

@smitpatel
Copy link
Contributor

for indexes implemented in bc4609b
Pending for foreignkeys

@rowanmiller rowanmiller modified the milestones: 7.0.0-rc2, 7.0.0 Dec 7, 2015
@smitpatel
Copy link
Contributor

Should base type lift the FK from derived type if defined on same features? or block it?

@ajcvickers ajcvickers added the closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. label Oct 15, 2022
@ajcvickers ajcvickers modified the milestones: 1.0.0-rc2, 1.0.0 Oct 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-enhancement
Projects
None yet
Development

No branches or pull requests

4 participants