Print Page | Close Window

Concurrency column in a Complex Object

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2010
Forum Discription: For .NET 4.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=2698
Printed Date: 01-May-2025 at 10:13am


Topic: Concurrency column in a Complex Object
Posted By: danielp37
Subject: Concurrency column in a Complex Object
Date Posted: 19-May-2011 at 1:02pm
I have a complex object called "AuditInfo" that basically has 4 properties on it: CreatedAt, CreatedBy, ModifiedAt, ModifiedBy.

I am trying to set the ModifiedAt as a AutoDateTime concurrency column.

When I set the Concurrency Stategy to AutoDateTime, I am able to save the object, but the update doesn't update the ModifiedAt to the current DateTime.

When I set the Concurrency Stategy to Client and set the property during the EntityServerSaveInterceptor.ExecuteSave method, the update statement sets the ModifiedAt field, but it also checks the ModifiedAt column against the new value of ModifiedAt instead of the original value.

Am I doing something wrong or are concurrency fields on complex objects not supported?

If I could even have the whole AuditInfo complex type treated as a concurrency property then I could use that but when I set the Concurrency Mode to Fixed on that Property of the Entity it doesn't appear to be checking it for concurrency.

Dan



Replies:
Posted By: robertg
Date Posted: 19-May-2011 at 2:42pm
Dan,
 
We should be support the functionality as EF, in this. I'll research this, and get back to you tomorrow. 
Thanks,
-- Robert


Posted By: robertg
Date Posted: 19-May-2011 at 5:23pm
Dan,
 
This limitation seems to be with EF itself, as a project in plain EF shows the same behavior as one with DF. For now, I suggest that you check concurrency against simple scalar properties instead, as that definitely works.
 
-- Robert


Posted By: danielp37
Date Posted: 20-May-2011 at 7:33am
I was afraid of that.  Oh, well, it would have been really convenient.  I have just gone with removing the ModifiedAt from the ComplexObject and putting it as a regular scalar property on the Entity itself and this appears to be working.


Posted By: robertg
Date Posted: 20-May-2011 at 11:03am
Yeah. Sorry Dan, I went through a number of permutations in both DF and EF trying to get it to work before I broke the bad news that it doesn't. I really hope EF documentation is improved significantly soon.



Print Page | Close Window