I want to create Code First Entity Framework Model with some value objects. I got exception:
EntityType 'CustomValueObject' has no key defined. Define the key for this EntityType.
I don't want to add a key, because it isn't a full entity.
I want to create Code First Entity Framework Model with some value objects. I got exception:
EntityType 'CustomValueObject' has no key defined. Define the key for this EntityType.
I don't want to add a key, because it isn't a full entity.
It was enough to add annotation [ComplexType]
to class:
[ComplexType]
public class CustomValueObject
{ ... }
Even better is to add this annotation to base class ValueObject
, if there is one.