Concurrency Example


Author
Message
Greg McGuffey
Greg McGuffey
Strategic Support Team Member (3.4K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
This sample (in C# for now) can be used to investigate how concurrency checking/resolution works in SF. The application has a single form that uses a splitter to show two customer forms (from the StrataFrameSample db's Customers table). Each side uses its own BO. Thus you can change one side, and while on the same record, change other side and see how concurrency works.



This also shows one of the ways you can customize concurrency by manipulating the FieldsCollisions provided to the standard SF collision form. This is used to separate "system" collisions, such as those that will occur with row version or time stamp columns from "user" collisions. With this customization, the system collisions are now shown and are handled automatically.



You can turn on/off this customization via the Auto Handle Concurrency checkbox at the bottom of the form. You can also turn on/off debugging the data source (sql debugging) on the bottom. There is a link to the debug file there also.



To summarize how concurrency works:



1. First it is determined if there is a concurrency issue. This is done via a combination of a concurrency check within the insert/update/delete statement (check if current row version/timestamp/all fields match the server values) which if it fails will result in no data being changed on the server and on a check of the record count (zero if concurrency check fails).



2. If there is a concurrency issue, a list of fields that will collide with the values on the server is built, to allow the user (or the app) to decide which of the collided values to use.



Collisions are determined at the field level and can be defined to mean that the user is updating a field without knowing the state of the value on the server and the update would change the value on the server.



What happens with a concurrency issue is controlled at the form level with the AutoHandleCollisions property and the CollisionNotificationType property of BOs. (How concurrency is checked is controlled at the BO level by the RowVersionOrTimeStampColumn, UpdateConcurrencyType and DeleteConcurrencyType properties.) When an event is raised for concurrency issues, you are provided with a collection of all fields that colliding. You can manipulate this collection as needed and/or provide your own form (not shown in demo) to show the collisions or any other information needed.



A couple forum posts on concurrency:



http://forum.strataframe.net/FindPost6191.aspx



http://forum.strataframe.net/FindPost5006.aspx



Attachments
ConcurrencySample.zip (280 views, 45.00 KB)
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search