New Posts New Posts RSS Feed: ConcurrencyCheck
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

ConcurrencyCheck

 Post Reply Post Reply
Author
gregweb View Drop Down
DevForce MVP
DevForce MVP
Avatar

Joined: 10-Sep-2009
Location: Clearwater, Fl
Posts: 253
Post Options Post Options   Quote gregweb Quote  Post ReplyReply Direct Link To This Post Topic: ConcurrencyCheck
    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?
Back to Top
mgood View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 18-Nov-2010
Location: Emeryville, CA
Posts: 583
Post Options Post Options   Quote mgood Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
gregweb View Drop Down
DevForce MVP
DevForce MVP
Avatar

Joined: 10-Sep-2009
Location: Clearwater, Fl
Posts: 253
Post Options Post Options   Quote gregweb Quote  Post ReplyReply Direct Link To This Post Posted: 16-Feb-2013 at 1:23pm
Great, nice feature.

Greg
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down