How to map a Value Object in Entity Framework 4
I want map a value object in Entity Framework 4 as in NHiber开发者_JAVA百科nate where I use Component-Class (Nested in AR). How do I do this?
There are two ways that I know of. The easiest is to use ComplexType, which cannot have a key. The more difficult way is to use a POCO with all setters marked private (example) and with a key, which will allow you to persist it to a separate database table. (Or you can kinda mix to two and do the former with private setters, I suppose.)
精彩评论