Entityframework recursive query triggering Exception

Asked

Viewed 75 times

2

When performing the query with recursion an Exception is occurring:

Equipe.RelatorioRH.Single(x => x.IdRodada == IdRodada)

'Entityframeworkdynamicproxies-Model' metadata is invalid. If you are debugging a mini-dump, you can fix the problem by collecting a new mini-dump with heap and evaluating the expression again. Model.Reportariorh

Would anyone know what this is about? How to solve this?

2 answers

2

When you use the method Single() and the query does not return 0 or more than 1 record, an Exception occurs. Make sure that’s what happened.

If the field you are looking for is a key Primary, you can use the Find(), for example.

  • 1

    Thank you for the reply. I described below as a response the solution I found. Unfortunately the feedback the IDE gave describing the error confused the interpretation of the problem.

1


I found out what was going on.

A method that calls a second method that in turn called the first again. This caused the Exception. Unfortunately Visual Studio described that way hindered the understanding of the problem.

  • That’s not an answer.

Browser other questions tagged

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