none
What does this mean? Referential integrity constraint violation. A Dependent Role has multiple principals with different values. RRS feed

  • Question

  • Trying to update the following entity and I get th message:

        [Key]
        public string                    Id                 { getset; }
        public SosDescription            Description        { getset; }
        public bool                      IsNode             { getset; }
        [ForeignKey("ParentId")]
        public virtual BaseSystem        Parent             { getset; }
        public virtual string            ParentId           { getset; }
        public virtual ICollection<BaseSystem> SubSystems         { getset; }
        public HealthStatus              Status             { getset; }
        public HealthStatus              ComposedStatus     { getset; }
        public ICollection<DiagnosticElement> DiagnosticElements { getset; }
        public int                       FailureCount       { getprivate set; }
          modelBuilder.Entity<BaseSystem>()
            .HasOptional(p => p.Parent)
            .WithMany(p => p.SubSystems)
            .HasForeignKey(p => p.ParentId)
            .WillCascadeOnDelete(false);
    Monday, January 16, 2012 10:23 PM

Answers

  • @Allen thx but i got it to work. But I don't know how! ... possibly a problem in my fake data.

    Can you explain me more about the message: "Referential integrity constraint violation. A Dependent Role has multiple principals with different values."

    Here's what I think it means:

    I have a FK from a parent to a child, and in the same child I am trying to save 2 or more parent referring to it.

    Is that it?

     

    Wednesday, January 18, 2012 12:07 PM

All replies

  • Hi Yvangelist,

    Welcome to MSDN Forum.

    Could you please post the message you got here?

    Best Regards


    Allen Li [MSFT]
    MSDN Community Support | Feedback to us
    Wednesday, January 18, 2012 1:54 AM
    Moderator
  • @Allen thx but i got it to work. But I don't know how! ... possibly a problem in my fake data.

    Can you explain me more about the message: "Referential integrity constraint violation. A Dependent Role has multiple principals with different values."

    Here's what I think it means:

    I have a FK from a parent to a child, and in the same child I am trying to save 2 or more parent referring to it.

    Is that it?

     

    Wednesday, January 18, 2012 12:07 PM
  • Hi Yvangelist,

    Yes, you understand correctly.

    Best Regards


    Allen Li [MSFT]
    MSDN Community Support | Feedback to us
    Thursday, January 19, 2012 2:23 AM
    Moderator