Creating complex objects

The Entity Model Designer couldn’t make it easier to create a single complex object. You just select the properties you want to abstract, right-click them and choose Refactor into New Complex Type from the context menu. The designer creates the class and handles the mapping for you:

Image

Once you choose Refactor into New Complex Type, Entity Framework doesn’t ask any more questions. It just does it. It creates the complex type, replaces the original properties with a single complex property, and fixes up the mappings:

Image

Get Fluent Entity Framework now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.