msawczyn/EFDesigner

Concurrency mode: optimistic

ddewaleffe opened this issue · 3 comments

Created a small model with Optimistic concurrency mode, using the default Timestamp as concurrency token property.
The generated code cannot be compiled due to generation of a line in several methods:

Timestamp = _timestamp;

where _timestamp is not declared at all, but it mentioned as parameter of the method in he documentation comment.

Good catch! Seems two spots got missed in the text templates when doing the concurrency property fix. I'll get those pushed out in the next release, but in the interim you can do the following:

In EFDesigner.ttinclude, change lines 409 and 491 (same code in both places) from

   foreach (ModelAttribute requiredAttribute in modelClass.AllRequiredAttributes.Where(x => !x.IsIdentity && x.SetterVisibility == SetterAccessModifier.Public))

to

   foreach (ModelAttribute requiredAttribute in modelClass.AllRequiredAttributes.Where(x => !x.IsIdentity && !x.IsConcurrencyToken && x.SetterVisibility == SetterAccessModifier.Public))

That should fix it.

This is fixed in v1.2.6.18

Closing since fix is now released