I have develop an application in MVC.
I have 4 tables in MYSQL database.
Topic(topicid,topic) with topicid as primary key
subtopic(subtopicid,subtopic)with subtopicid as primary key
question(questionid,question,answer) with question as primary key
Detail(Id,topicid,subtopicid,questionid,title); with Id as primary key
I have used ADO.net Entity framework in MVC to create the model using the database. I want to set the mapping between Detail-Topic, Detail-subtopic, Detail-question.
I have done 1:many mapping using the above structure between tables and getting the exception
Error 3007: Problem in Mapping Fragments: Non-Primary-Key column(s) [topicid] are being mapped in both fragments to different conceptual side properties - data inconsistency is possible because the corresponding conceptual side properties can be independently modified similar error is getting for subtopicid and questionid.
When this error occurred then In Detail table I made the topicid,subtopicid,questionid as PK Then the mapping was done but while performing update and insertion error related to PK violation is done.
Is there a way in which we can make the PK as the combination of keys (Id,topicid,subtopicid,questionid) if the mapping require them to PK. or any other way to add the mapping between the tables. Thanks..