Suppose that I have a Entity called "car".
I use a complex type to define the "Engine" part.
[TableName("T_CAR")]
public sealed class Car:IEngine
{
...
public EngineType EngineType{get;set;}
}
[ComplexType]
public sealed class Engine:IEngine
{
public Engin( )
{
this.EnginType = new EngineType( );
}
public EngineType EngineType{get;set;}
// other properties ...
}
[ComplexType]
public sealed class EngineType:IEngineType
{
...
}
When I run this code, I have a error message from EF 6 :
System.InvalidOperationException: The type 'Engine' has already been configured as an entity type. It cannot be reconfigured as a complex type.
And if I remove the definition of EngineType, it works ...
Is there a way to add a nested complex type in another complex type ?