This project is read-only.

How to activate TimeStamp concurrency in EFDAL

Apr 24, 2012 at 2:40 PM

Hi,

I don't seem to find how to activate TimeStamp concurrency with EFDAL in a multi-process scenario.

To try it I wrote a console application, using EFDAL, that

  • loads the entity with id = 1
  • changes a property to something unique
  • waits for the user to press any key
  • saves the entity

I then start 2 of these concoles simultaneously.
When debugging I see they both load the same entity with the same TimeStamp.
They both change the same entity-property to some unique guid.
The first console where I press any key saves the entity and I see the value of TimeStamp changing on the entity and in my database.
When I press any key on the second console that one also saves the entity without any problem.

What I would expect is that the second console throws an error because the TimeStamp value in the database, for the entity with id = 1, has changed.

Am I missing something?

Apr 24, 2012 at 6:50 PM
Edited Apr 25, 2012 at 1:02 AM
There was an issue with concurrency with the Entity Framework stored procs. I have attached a new SQL generator. Copy this on top of your existing one. You folder should look something like this:

C:\Users\[YOURNAME]\AppData\Local\Microsoft\VisualStudio\10.0Exp\Extensions\nHydrate.org\nHydrate Modeler\5.0.0.0

We select data back out, but this causes the row count to be 1 not 0. An error occurs if 0 records are affected and since we perform another statement this is never true. So the violation is never found. After you generate the database project, you will notice the delete and update procedures are different. If 0 rows are affected the procedure ends and the framework will throw an "OptimisticConcurrencyException" exception.

Rename this file and unzip it.

--Chris Davis

On Tue, Apr 24, 2012 at 9:40 AM, jeankedotcom <notifications@codeplex.com> wrote:

From: jeankedotcom

Hi,

I don't seem to find how to activate TimeStamp concurrency with EFDAL in a multi-process scenario.

To try it I wrote a console application, using EFDAL, that

  • loads the entity with id = 1
  • changes a property to something unique
  • waits for the user to press any key
  • saves the entity

I then start 2 of these concoles simultaneously.
When debugging I see they both load the same entity with the same TimeStamp.
They both change the same entity-property to some unique guid.
The first console where I press any key saves the entity and I see the value of TimeStamp changing on the entity and in my database.
When I press any key on the second console that one also saves the entity without any problem.

What I would expect is that the second console throws an error because the TimeStamp value in the database, for the entity with id = 1, has changed.

Am I missing something?

Read the full discussion online.

To add a post to this discussion, reply to this email (nhydrate@discussions.codeplex.com)

To start a new discussion for this project, email nhydrate@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com




--
If you have any questions please let me know.

Thank you for your interest,
Christopher Davis, MCAD

Code Generation: http://www.nhydrate.org

Apr 25, 2012 at 1:03 AM

This fix will be in the next version very soon.

Apr 25, 2012 at 7:39 AM

Hi,

I did not receive any attachments. Could you resend the new SQL generator?

Thx.

Apr 25, 2012 at 1:12 PM
I do not know why it did not come through. Just download it from here.

http://www.nhydrate.org/downloads/sqlgenerator.zip

--Chris Davis

On Wed, Apr 25, 2012 at 2:39 AM, jeankedotcom <notifications@codeplex.com> wrote:

From: jeankedotcom

Hi,

I did not receive any attachments. Could you resend the new SQL generator?

Thx.

Read the full discussion online.

To add a post to this discussion, reply to this email (nhydrate@discussions.codeplex.com)

To start a new discussion for this project, email nhydrate@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com




--
If you have any questions please let me know.

Thank you for your interest,
Christopher Davis, MCAD
(+1) 866.GRAVBOX
(+1) 866.472.8269

Code Generation: http://www.nhydrate.org
Consulting Site: http://www.widgetsphere.com
Cloud Repositories: http://www.celeriq.com

Apr 25, 2012 at 3:39 PM

Ok, concurrency seems to work with the new SQL Generator.

Thx.