Note that there are some explanatory texts on larger screens.

plurals
  1. POEach type name in a schema must be unique
    primarykey
    data
    text
    <p>I have a model with the following structure where I have lists of Codes that can be used within the system. </p> <p>There is a one to one relationship between a car and an engine so I want the engine details to be mapped to the Car table so an engine is not an entity its just a domain model abstraction. That engine contains a Code that describes the engine Type.</p> <p>My dbcontext has a DbSet for CodeList and for Car as they are the two aggregate roots in the system. When I attempt to map this to the database I get the following error:</p> <p>Each type name in a schema must be unique. Type name 'Code' is already defined. </p> <p>If I remove the Navigation property in the Engine class then the problem goes away but I want to be able to access the Code value without having to look it up independently. If I remove the virtual and attempt to map the id property of the code directly it tells me Code is defined as an entity and may not be redefined as a complex type. I am not sure where I am going wrong with this it seem like a straight forward usage. It looks like Engine is being treated as a Complex Type and therefore cannot have Navigation Properties. </p> <pre><code>CodeList { public int Id {get;set;} public string Name {get;set;} public IList&lt;Code&gt; codes {get;set;} } Code { public int Id {get;set} public string Value {get;set;} } public Car { public int Id {get;set;} public Engine Engine {get;set;} } public Engine { public int Size {get;set;} public int TypeId {get;set;} public virtual Code Type {get;set;} } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload