The thing is that i’m trying to make an easy query with my Entity FrameWork .Net Core 7.0 Linq in Vb.Net:
Public Function GetOneRecord(idOne As Long, idTwo As Long) As Reply(Of Object)
Dim reply As New Reply(Of Object)
Try
reply.obj = db.Table.
Include("AnotherTable1").
Include("AnotherTable1.AnotherTable2").AsNoTracking().
Where(Function(a) a.SomeId = idOne AndAlso a.SomeIdTwo = idTwo).FirstOrDefault()
If (Not reply.obj Is Nothing) Then
reply.ok = True
' Everything its Ok
Else
reply.ToError("Couldn't find the record...")
End If
Catch ex As Exception
reply.ToError("Couldn't get the records correctly...")
End Try
Return reply
End Function
The query is working fine, everytime i call that function it works fine, the problem is that sometimes, the function returned me “Couldn’t find the record…”, it means, the record was not found, but is the same record i’m calling like 20-30 times before the code return it couldn’t find it
So every 20 to 30 times (sometimes more, sometimes less) i try to get some Record, it works fine but then, some of the callings just don’t get the record well
What should i do to fix this?
I don’t even know what the problem is, because the record do exist, and the function returned me the record correctly, its just one spontaneous query that did not “found” it
This is happening to me with only this Function, im not specting this error with another function or “query” to database (with my Computer SSQL Server and it fails with my Azure Database too, so its not a database problem)
Im getting all the DataBase Model with a “Scaffold-DbContext” Query Console
Sorry if my english is not good enough:/
Dunno what to do, this error is just spontaneous
Josué David Alpizar Cruz is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.