Using EF 4.1, can a complex type refer to an object (for example, in DDD, a value object that refers to an object)?

The blog post I read seems to indicate that for objects the values ​​are referenced by objects in the domain design, and the follow-up explains how to do this in NHibernate.

I would like to do the same with Entity Framework 4.1: in particular, have a complex type of reference to another object. As an example, consider this: I have an object, say, an Invoice that has the Total property of the Currency type. A currency is a complex type containing a decimal property called Value and a Unit property of CurrencyUnit type, CurrencyUnit is a "reference data object". That is, CurrencyUnit in this particular domain is an entity, not an object of value.

Now, perhaps "allowed" in DDD, this is not my preference; I do not want to discuss virtues. I am interested in learning if EF has a code solution to handle this scenario. I cannot find anything that is odd, since complex types are mapped to their entity containing a table, which, of course, can have foreign key references.

+3
source share
1 answer

Crud (not intended for puns) I just found this question, the answer of which indicates it was simply not implemented in EF 4.1: a complex type of EF4 with a navigation property (is this possible) or alternatives?

+1
source

All Articles