Nested Owned Type Contains Navigation Property - Not Work
- Dominant language
- C#
- Stars
- 14.8k
- Forks
- 3.4k
- PR merge metrics
- PR metrics pending
Description
I try to define my data model much closer to domain models, but I think that Ef does not support this simple need. I worked with ownsMany, ownsOne, hasMany, hasOne, withOwner, Navigation builder, IEntityTypeConfiguration, and ... in different ways.
```C#
public class Custom
{
[Required]
public int id { get; set; }
public string name { get; set; }
public Demo demo{ get; set; }
}
[Owned()]
public class Demo
{
public virtual ICollection pDemoes{ get; set; }
}
public class PDemo
{
[Required]
public int id { get; set; }
public string name { get; set; }
[ForeignKey("Custom")]
public int CustomId{ get; set; }
public virtual Custom Custom{ get; set; }
}
```
EF Core Add-Migration Says :
```
Unable to determine the relationship represented by navigation 'Demo.pDemoes' of type 'ICollection'.
Either manually configure the relationship, or ignore this property using the '[NotMapped]' attribute or
by using 'EntityTypeBuilder.Ignore' in 'OnModelCreating'.
```
Contributor guide
Assessment
This issue has not been assessed yet.