entity framework - How to avoid invalid concurrent modifications in EF 4 -


i have 3-tier application:

  1. client application
  2. server application
  3. database server

the server uses entity framework 4 read , write data to/from database.

imagine following situation:

  1. client application creates instance of entity rowversion property. @ point in time, property equal null.
  2. client application sends request "save instance in database" server.
  3. server saves object in database , automatically sets value of rowversion property. @ client side, value still equal null.
  4. client application modifies object created in first step, sends request server , server gets concurrency exception when trying save new version of object.

are there standard mechanisms solving type of problem?

i dont know how system works inside (think communication between client , server goes using api). see trying handle situation when 2 clients modifying same entity , need notify client if trying save version older current.

so next:

  • on step 3 server must return version id (first save of entity)
  • next modification of entity client have version id , need check if current version id equal or older have on server (think rowversion timestamp)
  • server logic handle states , send client response: saved new version (if current version equal , send new version id) or false state if version older (other client made modification already).

this in simplified way.

[update]

looks in article find implementation close needs: http://weblogs.asp.net/ricardoperes/archive/2012/05/28/yet-another-asp-net-mvc-crud-tutorial.aspx


Comments

Popular posts from this blog

android - getbluetoothservice() called with no bluetoothmanagercallback -

sql - ASP.NET SqlDataSource, like on SelectCommand -

ios - Undefined symbols for architecture armv7: "_OBJC_CLASS_$_SSZipArchive" -