0

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.

Pati K
  • 129
  • 2
  • 11

1 Answers1

0

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.

Pati K
  • 129
  • 2
  • 11