Note that there are some explanatory texts on larger screens.

plurals
  1. POInvalid column name 'rootQuestion_QuestionID' while reverse engineering in visual studio .net
    primarykey
    data
    text
    <p>I have a problem mapping a relationship while reverse engineering in visual studio .net</p> <p>I use inheritance:</p> <pre><code>public class Quiz : Component { public QuizQuestion rootQuestion { get; set; } public override String getType() { return "quiz"; } } </code></pre> <p>the property 'rootQuestion' is not specified in the motherclass, it only exists in the subclass</p> <p>'Quiz' doesn't exist as a table in my sqlserver database(only the QuizQuestions and Component table exists in the database,( my teacher told me to do it like this for the java part of this project). But I want the subclass Quiz to have a property rootQuestion that refers to quizRootQuestion in my database so here's what i did:</p> <pre><code>public class QuizMapper : EntityTypeConfiguration&lt;Quiz&gt; { public QuizMapper() { this.HasKey(t =&gt; t.ComponentID); this.HasOptional(c =&gt; c.rootQuestion) .WithMany().Map(m =&gt; m.MapKey("quizRootQuestionID")); } } public class QuizQuestionMap : EntityTypeConfiguration&lt;QuizQuestion&gt; { public QuizQuestionMap() { // Properties // Table &amp; Column Mappings this.HasKey(t =&gt; t.QuestionID); this.ToTable("QuizQuestions"); this.Property(t =&gt; t.QuestionID).HasColumnName("questionID"); } } </code></pre> <p>I get this error when i'm trying to run in my browser:<br> <strong>Invalid column name 'rootQuestion_QuestionID'.</strong></p> <p>Tables in my database:</p> <p><em>Component:</em><br> componentId<br> quizRootQuestionID<br> TypeId(=discriminator)</p> <p>and</p> <p><em>QuizQuestions</em><br> questionID<br> question</p> <p>Can someone please tell me what i am doing wrong?</p>
    singulars
    1. This table or related slice is empty.
    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