Hi guys, I'm running into some very strange (possible caching) problems... See comments in codefragment below...
I've had the same problem yesterday... I delete a row directly in the database, but EntitySpaces keeps loading it somehow??
Code:
Dim w As New EC.BLL.WoOperation
Dim workorderPlan As BLL.EpPlan
Dim workorderPlanQuery As BLL.EpPlanQuery
Dim workorderPlanCollection As BLL.EpPlanCollection
If w.LoadByPrimaryKey(WooKey) Then
'Values are added here...
workorderPlan.Save()
'Loaded again because primary key is not filled automatically
workorderPlanCollection = New BLL.EpPlanCollection
workorderPlanQuery = New BLL.EpPlanQuery
workorderPlanQuery.Where(workorderPlanQuery.WooKey.Equal(w.WooKey))
workorderPlanCollection.Load(workorderPlanQuery)
'The following Select statement goes to Is > 1 case, workorderPlanCollection.Count seems to be 26????? I've just removed ALL records and it's still 26!!!!
Select Case workorderPlanCollection.Count
Case 0
'insert failed
Case 1
workorderPlan = workorderPlanCollection(0)
Case Is > 1
'I've looped through the collection and MsgBoxed the primary key, it starts with 51 and goes up to some 100 or 200 values, but the sequence is at 4100 at the moment when inserting a new row???!?!??!
End Select
End If