none
ERROR 3007 PROBLEM IN MAPPING RRS feed

  • Question

  • Hi @ All,

    On my DB i have

    table1: [PERSON]{pId,fName,lName}

    this has s many to many association with table2: [skill]{skillId,SkillName}

    and the association table3 [skill_Person]{s_p_ID,pId, skillId}

    after including my data Model from my DB, i cant see the pId and skillId by the  table3 [skill_Person]

    so i added 2 scalar Property on the table3  skill_Person in my Model

    i maked  a mapping for the 2  Properties

    but now i Have this EROOR

    Error    1    Error 3007: Problem in Mapping Fragments starting at lines 1094, 1303: Non-Primary-Key column(s) [PERSON_ID] 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.

    Error    2    Error 3007: Problem in Mapping Fragments starting at lines 1094, 1329: Non-Primary-Key column(s) [SKILL_ID] 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.
      
    Pls HELP!!

    :)

    Tuesday, October 4, 2011 12:15 PM

Answers

  • Hi elecmen;

    The junction table as you have it set up will not show up in the designer and this is by design but they are incorporated into the navigation properties. Please read this article Entity Framework: Queries involving many to many relationship tables to see how to work with them.

     


    Fernando (MCSD)

    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".
    • Marked as answer by elecmen Tuesday, October 4, 2011 3:26 PM
    Tuesday, October 4, 2011 1:22 PM

All replies

  • Hi elecmen;

    The junction table as you have it set up will not show up in the designer and this is by design but they are incorporated into the navigation properties. Please read this article Entity Framework: Queries involving many to many relationship tables to see how to work with them.

     


    Fernando (MCSD)

    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".
    • Marked as answer by elecmen Tuesday, October 4, 2011 3:26 PM
    Tuesday, October 4, 2011 1:22 PM
  • thank you for your answer
    Tuesday, October 4, 2011 3:26 PM
  •  

    Not a problem elecmen, glad to help.

     


    Fernando (MCSD)

    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".
    Tuesday, October 4, 2011 3:44 PM
  • Now i have my view with   pid, fName, lName from the table 1 and the skill name from the table 2

    after this i want to implemate An edit and an Create view for this Model

    fname

    lname

    and skill

    first i must t create a person therfor i became a Pid

    than i can give the skill to this person

    the Problem is

    if i create a person my next view is giving a skill  to this person

    so tried somethins like this

    public ActionResult skillCreate()
            {
                return View();
            }
            // POST: /Person/PersonSkill
            [AcceptVerbs(HttpVerbs.Post)]
            public ActionResult skillCreate(int id,FormCollection collection)
            {
                try
                {
                    // TODO: Add insert logic here
                    /*-----------------------------------*/
                    var entities = new QM_DB_Entities();
                    var Pid = long.Parse(collection["PERSON_ID"]);
    
                    var skillToAdd = entities.SKILL_PERSON.First(m => m.PERSON.PERSON_ID == Pid);
                    // Deserialize (Include white list!)
                    TryUpdateModel(skillToAdd, new string[] { "PERSON_ID", "SKILL_ID"}, collection.ToValueProvider());
    
    
                    // Validate
                    if (String.IsNullOrEmpty(skillToAdd.SKILL.SKILL_ID.ToString()))
                        ModelState.AddModelError("SKILL_ID", "Add a Skill is required!");
                    
    
                    // If valid, save movie to database
                    if (ModelState.IsValid)
                    {
    
                        entities.AddToSKILL_PERSON(skillToAdd);
                        entities.SaveChanges();
                        return RedirectToAction("Index");
                    }
    
                    // Otherwise, reshow form
                    return View(entities);
    
                    /*-----------------------------------*/
    
                    //return RedirectToAction("Index");
                }
                catch
                {
                    return View();
                }



      it doesent work, i follow this with the debugging.

    i dont find in PERSON_ID and SKILL_ID in the var SkillToAdd

    can you help me pls :)

     

    table1: [PERSON]{pId,fName,lName}

    this has s many to many association with table2: [skill]{skillId,SkillName}

    and the association table3 [skill_Person]{s_p_ID,pId, skillId}


    • Edited by elecmen Wednesday, October 5, 2011 10:33 AM
    Wednesday, October 5, 2011 10:29 AM
  • Hi elecmen;

    Please post this question to a new thread.

     

    Thank you so much.

     


    Fernando (MCSD)

    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".
    Wednesday, October 5, 2011 4:31 PM