How to deal with value objects in Entity Framework?

domain-driven-design entity-framework

Accepted Answer

In his great book Putting Domain-Driven Design into Practice, Vaughn Vernon talks about Persisting Value Objects (page 248).

Single Value Objects and ORM

The basic idea is to store each of the attributes of the Value in separate columns of the row where its parent Entity is stored. Said another way, a single Value Object is denormalized into its parent Entity's row. There are advantages to employing convention for column naming to clearly identity and standardize the way serialized objects are named.

A database entity is backed by ORM and Many Values.

A very straightforward approach to persisting a collection of Value instances using an ORM and a relational database is to treat the Value type as an entity in the data model. (...) To accomplish this we can employ a Layer Supertype.

Here is an example of a bounded context in C#: https://github.com/VaughnVernon/IDDD_Samples_NET

14
5/23/2015 7:15:10 AM

Popular Answer

ZZZ_tmp


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow