Udostępnij za pośrednictwem


MappedEntityDomainManager<TData,TModel>.SetOriginalVersion Method

Definition

Override this method to support optimistic concurrent updates and replace operations. In order to evaluate whether an object has been updated concurrently, Entity Framework needs to know the original version of the object being edited and compare that to the current version maintained in the database. This requires that the original value is known by Entity Framework so that it can ask the database to do the check.

protected virtual void SetOriginalVersion (TModel model, byte[] version);
abstract member SetOriginalVersion : 'Model * byte[] -> unit
override this.SetOriginalVersion : 'Model * byte[] -> unit
Protected Overridable Sub SetOriginalVersion (model As TModel, version As Byte())

Parameters

model
TModel

The current entity model object.

version
Byte[]

The original version provided by the request as being the version that is being updated; or null if no version was indicated.

Remarks

In case the column used to manage versioning is called "Version", the code to set the original value looks like this:

this.context.Entry(model).OriginalValues["Version"] = version;

Applies to