當前數據庫情況如圖
所示


第一步在概念模型設計器裡按照圖所示分別把NotebookBrand和NotebookType屬性的Concurrency Mode設置為Fixed
然後我們寫一段代碼來模擬一個並發沖突的情況
Create object context
Dim objContext
As New NbWhEntities()
Dim objContext
As New NbWhEntities()
Query the same record as
entities
Dim laptop
= (From aLaptop In objContext
Notebook _
Where aLaptop
Id =
_
Select aLaptop)
FirstOrDefault()
Dim laptop
= (From aLaptop In objContext
Notebook _
Where aLaptop
Id =
_
Select aLaptop)
FirstOrDefault()
Modify the entity
[] [] [] []
From:http://tw.wingwit.com/Article/program/net/201311/14743.html