Print Page | Close Window

Updating complex types doesn't work

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2009
Forum Discription: For .NET 3.5
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=1429
Printed Date: 12-Jan-2026 at 5:24am


Topic: Updating complex types doesn't work
Posted By: pk55
Subject: Updating complex types doesn't work
Date Posted: 17-Aug-2009 at 5:36pm

I changed an entity to use a complex type (editing the edmx in XML).  I can retrieve and bind data without issue. I can insert a new entity (which also binds correctly) and it persists to the database correctly. I can delete rows in a child collection without a problem.  Only UPDATE isn't working.  I see (in SQL Profiler) that it generates update SQL but fails to include the actual columns that were changed (it only has a test for the timestamp column and sets a variable that it declares; the "@p" in the sql shown below).  If I also modify a column that is just a scalar property, that column gets updated but not any columns in the complex type. 

Here's the UPDATE SQL that was generated:
exec sp_executesql N'declare @p int
update [dbo].[myTable]
set @p = 0
where (([myKeyColumn] = @0) and ([timestamp] = @1))
select [timestamp]
from [dbo].[myTable]
where @@ROWCOUNT > 0 and [myKeyColumn] = @0',N'@0 int,@1 binary(8)',@0=9367,@1=0x000000000204D184
 
I was able to modify the entity prior to switching to complex types without any issue.
 
Any thoughts?



Replies:
Posted By: WardBell
Date Posted: 17-Aug-2009 at 6:15pm
Will look into it right away


Posted By: eileenv
Date Posted: 18-Aug-2009 at 3:50pm

After you changed the entity to a complex type, did you regenerate your model either in the Object Mapper or when prompted by a "DevForce Model Change Detected" dialog? I'm only asking because we have unit test cases where we successfully make updates to a complex type.



Posted By: pk55
Date Posted: 18-Aug-2009 at 4:02pm
Yes, it was regened.  And as I said, I was able to Insert that same entity using complex types (create entity, set some of the non-nullable properties in code, add it to the entity manager, add it to the datasource of the usercontrol and then edit the object, changing some of the values added in code and then saved) so it makes me think the change tracking isn't quite right :-)


Posted By: kimj
Date Posted: 23-Aug-2009 at 6:25pm
This will be fixed in the 5.2.2 release, due the first week of September.


Posted By: pk55
Date Posted: 24-Aug-2009 at 11:56am
Thanks Kim.  That's great.



Print Page | Close Window