Print Page | Close Window

ConcurrencyCheck

Printed From: IdeaBlade
Category: Cocktail
Forum Name: Community Forum
Forum Discription: A professional application framework using Caliburn.Micro and DevForce
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=3992
Printed Date: 27-Oct-2025 at 2:15pm


Topic: ConcurrencyCheck
Posted By: gregweb
Subject: ConcurrencyCheck
Date Posted: 16-Feb-2013 at 12:33pm
I notice in Cocktail that in AuditEntityBase, there is this property:

        [DataMember]
        [ConcurrencyCheck]
        [ConcurrencyStrategy(ConcurrencyStrategy.AutoIncrement)]
        public int RowVersion { get; internal set; }

If I test this with two simultaneous instance of TempHire, I do indeed get a messagebox saying that the record had been previously saved by another user.

So two questions:

1. Most of the samples I have seen has used TimeStamp as the data type instead of int. Any particular reason for using int instead?

2. Is there anything else required to concurrency checking other than using the above attributes?



Replies:
Posted By: mgood
Date Posted: 16-Feb-2013 at 1:14pm
1. I simply prefer row version, so I know how many times the record has been modified. 

2. ConcurrencyCheckAttribute is the only attribute required to enable concurrency checking. If you use timestamp then that's all you need, because the database is automatically setting the timestamp. ConcurrencyStrategyAttribute is a DevForce attribute. The database won't automatically increment a row version, so the attribute is telling DevForce to increment it.


Posted By: gregweb
Date Posted: 16-Feb-2013 at 1:23pm
Great, nice feature.

Greg



Print Page | Close Window