13

Closed

Reverse engineering does not mark rowversion/timestamp columns as concurrency tokens

description

Please add a feature to automatically set ConcurrencyMode=Fixed.

EF defaults to no concurrency control (last write wins) which allows lost updates.
Enforcing optimistic concurrency checks can explicitly be configured by setting ConcurrencyMode=Fixed on a RowVersion column.

Having to do this manually when recreating an EF model from a database we risk forgetting it and running without concurrency control. Almost every DB application uses concurrency control and I expect there to be a way to automatically make the setting and not have to manually set it for each table.
Closed Dec 12, 2016 at 9:30 PM by RoMiller
EF Team Triage: We are transitioning this project to GitHub (https://github.com/aspnet/EntityFramework6). As part of this transition we are bulk closing a large number of issues in order that our new issue tracker will accurately reflect the work that our team is planning to complete on the EF6.x code base.

Moving forwards, our team will be fixing bugs, implementing small improvements, and accepting community contributions to the EF6.x code base. Larger feature work and innovation will happen in the EF Core code base (https://github.com/aspnet/EntityFramework). Closing a feature request in the EF6.x project does not exclude us implementing the feature in EF Core. In fact, a number of popular feature requests for EF have already been implemented in EF Core (alternate keys, batching in SaveChanges, etc.).

This is a bulk message to indicate that this issue was closed and not ported to the new issue tracker. The reasons for not porting this particular issue to GitHub may include:
  • It was a bug report that does not contain sufficient information for us to be able to reproduce it
  • It was a question, but sufficient time has passed that it's not clear that taking the time to answer it would provide value to the person who asked it
  • It is a feature request that we are realistically not going to implement on the EF6.x code base
    Although this issue was not ported, you may still re-open it in the new issue tracker for our team to reconsider (https://github.com/aspnet/EntityFramework6/issues). We will no longer be monitoring this issue tracker for comments, so please do not reply here.

comments

RoMiller wrote Oct 16, 2012 at 5:57 PM

We agree that the designer should set ConcurrencyMode=Fixed on rowversion columns when creating a model from the database. We are marking this to be fixed in the EF6 release.

pmeinl wrote Oct 24, 2012 at 9:58 AM

Please consider not only tying to the SQL Server RowVersion datatype.

Using a naming convention like column name = "RowVer" would be more flexible and especially enable this feature for other databases like Oracle too.

With ADO.NET it is always a nuisance for us that only SQLCommandBuilder implements the ConflictOption CompareRowVersion and Oracle CommandBuilder does not, while this would have been so easy to provide.

RoMiller wrote Jan 16, 2013 at 8:27 PM

We are only taking minimal changes to the designer in EF6 because we are still converting the code base to open source. We'll consider this bug for the next release.

LSx123xyz wrote Feb 25, 2013 at 10:16 AM

Hello

Looking for the same.

A prefix for the column name, or an SQL-Transact column property, that can be set in SQL Server Diagram designer.

Best regards

Luís Silva

jfbosch wrote Aug 19, 2013 at 10:38 PM

BriceLambson wrote Dec 27, 2013 at 9:05 PM

The Reverse Engineer Code First feature of One EF will do this automatically.

wezeku wrote Apr 28, 2014 at 4:14 PM

The workaround in jfbosch's link is fragile. It treats EDMX XML as 'dumb' text, not as XML.

I wrote a tiny utility to automate the ConcurrencyMode setting. You can either use it to set the mode for certain types (timestamp/rowversion) or for column names matching certain regex patterns.

http://blog.wezeku.com/2014/04/28/fixefconcurrencymodes/

https://github.com/wezeku/FixEFConcurrencyModes