Violation of multiple restriction

Asked

Viewed 191 times

1

Someone has already come across this error in an Asp.net mvc application?

Server Error in Application '/'.

There was a restriction violation of multiplicity of relation: an Entityreference may not have more than one related object, but the query returned more than one related object. This is an unrecoverable mistake.

After good period running normally the application started to give error when trying to call a list of data. Running the application I get this error.

  • From the statement, it seems to make reference to more than one object. I do not know at what moment is giving this error, should give more details. There is a design pattern, called Singleton, I don’t know if it comes to the case, but in situations where we should only have one and only one instance, this pattern is ideal. Take a look at it and see how to implement it, it’s the simplest thing on the planet.Now give us more information, show us what you’ve done so we can help you.

1 answer

1

Check the Attribute [Table] of their Models. Make sure you don’t have any repeats:

[Table("Cidades")]
public class Cidade { ... }
  • Thank you, Gypsy boy! I ended up discovering that they had entered a data that already existed in the bank and at the time of my consultation the programmed complained at the time of displaying the record. The error identified in my case not a repeated attribute in the model, but a duplicate record in a column/view of the model.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.