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

Unable to represent an entity that owns multiple one-to-one relationships #487

Open
ascott18 opened this issue Oct 30, 2024 · 0 comments
Open

Comments

@ascott18
Copy link
Collaborator

The following used to work automatically before 513db25

public class Parent {
  public int ParentId;

  public Child1 Child1;
  public Child2 Child2;
}

public class Child1 {
  [Key, ForeignKey("Parent")]
  public int ParentId;
  public Parent Parent;
}

public class Child2 {
  [Key, ForeignKey("Parent")]
  public int ParentId:
  public Parent Parent;
}

It no longer does after that commit.

Adding explicit config results in a codegen exception (due to ParentId owning multiple inverse navigations, I think)

public class Parent {
public int ParentId;
[InverseProperty(nameof(Child1.Parent))]
public Child1 Child1;

[InverseProperty(nameof(Child2.Parent))]
public Child2 Child2;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant