EF Core HasMany vs OwnsMany

后端 未结 1 885
不思量自难忘°
不思量自难忘° 2021-01-17 10:34

For one to many relationship, what\'s the difference between HasMany and OwnsMany? When should I use one over another?

1条回答
  •  -上瘾入骨i
    2021-01-17 11:08

    From documentation:

    EF Core allows you to model entity types that can only ever appear on navigation properties of other entity types. These are called owned entity types. The entity containing an owned entity type is its owner.

    Owned entities are essentially a part of the owner and cannot exist without it, they are conceptually similar to aggregates.

    https://docs.microsoft.com/en-us/ef/core/modeling/owned-entities

    0 讨论(0)
提交回复
热议问题