我正在利用实体框架和世界森林论坛,我遇到了一些错误,我不知道为什么。 在保存记录(使用<代码>BackgroundWorker)时,我确定各实体改轨为零(null),将记录附在新的可支配背景之下,但以该记录为准,并处理具体情况。
可在<条码>上发布记录火灾和事件 MainViewModel of the program that the other 意见书代码>(包括正在储蓄的代码)需要更新其实体以反映变化。
Private Sub _saveRecordWorker_DoWork(ByVal sender As Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles _saveRecordWorker.DoWork
Using MyContext As New RVShippingEntities
Dim MyShipment = CType(ShipmentRecord, IEntityWithChangeTracker)
MyShipment.SetChangeTracker(Nothing)
MyContext.Attach(MyShipment)
MyContext.Detach(ShipmentRecord)
End Using
End Sub
The Refresh background worker is similar, but it has a Do While
block to keep it from interfering with the save worker (which doesn t appear to be working; hence the post). When I save (and it subsequently refreshes) I get the following error:
The calling thread cannot access this object because a different thread owns it.
我认为,随着“<>日码/代码>的封条,它会等到(如果我通过它这样做的话),直到“午线”结束,而且所有这一切都将是好的。 但是,似乎有些东西(主线或救助线)仍在进行干涉。
是否有更好的办法这样做? 我用 go子做这件事吗? 希望得到任何帮助。
(Apoulo)承认判决为一字。 利息