EF Core 2.0 (re)introduces the concept of Complex types which are called Owned types in EF Core. I find the new naming confusing but hey that’s me…
Anyway let’s have a look at how we can use these Complex Owned types. We’ll start by creating a Supplier class with an Address;
Important to notice is that the Address does not have it’s own Id but is embedded into the Supplier class.
To configure the Owned types mapping, you have to use the OwnedOne method in the mapping file. If you want to further configure the properties of the Owned type, you’ll have to repeat the statement for every property in the Owned type:
That's it!