EntityFramework.Docs icon indicating copy to clipboard operation
EntityFramework.Docs copied to clipboard

Document that owned types are not the equivalent of complex types.

Open tbasallo opened this issue 2 years ago • 3 comments

Took me a while to realize that naming of this feature went from [Complex] to [Owned]. I could not find any documentation about the change nor any reference of these two together.

With all the documentation (blogs, videos, etc.) and information using the [Complex] naming for this feature, the change to [Owned] is somewhat hard, if not impossible, to find when searching the internet. It took me a good bit.

Some reference in the docs that search engines can pick up would help a lot.


Document Details

Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.

tbasallo avatar Feb 23 '23 01:02 tbasallo

@tbasallo The naming did not change. Complex types is a feature of the EF6 codebase. EF Core has never had complex types. Owned types have some similarities to complex types, but they actually behave in significantly different ways. Complex types are often used for "value objects" in EF6, and, while limited, are a pretty good fit in most ways. While people attempt to use owned types as value objects in EF Core, they are not a great fit.

I would say that, if anything, it might be worth adding to the documentation that owned types are not the same as complex types.

ajcvickers avatar Feb 23 '23 09:02 ajcvickers

Interesting. I guess as someone that tried finding a solution for an Address type that would translate to Address_streeet, Address_city in the DB, the only thing that Google provided was [Complex]. The EF6 docs also demonstrated it to be the right choice. But it may have been my word choice while searching.

Trying to do it in EF Core presented no IDE error/warning but would not work (migrations complained). It took a bug in EF Core's issue log during one of the previews to send me to the Owned type and realize that's what I needed to use.

I realize EFCore has been out now for a while now and I've never used it. My experience was with EF(4?). Perhaps it's common knowledge and Binging with Google lead me astray.

tbasallo avatar Feb 23 '23 13:02 tbasallo

Re-opening to consider adding a note that owned types are not the equivalent of complex types.

ajcvickers avatar Feb 23 '23 13:02 ajcvickers