New Posts New Posts RSS Feed: Updating complex types doesn't work
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Updating complex types doesn't work

 Post Reply Post Reply
Author
pk55 View Drop Down
Senior Member
Senior Member


Joined: 22-Jul-2009
Location: CA
Posts: 105
Post Options Post Options   Quote pk55 Quote  Post ReplyReply Direct Link To This Post Topic: Updating complex types doesn't work
    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?
Back to Top
WardBell View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 31-Mar-2009
Location: Emeryville, CA,
Posts: 338
Post Options Post Options   Quote WardBell Quote  Post ReplyReply Direct Link To This Post Posted: 17-Aug-2009 at 6:15pm
Will look into it right away
Back to Top
eileenv View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 15-Jun-2007
Location: United States
Posts: 68
Post Options Post Options   Quote eileenv Quote  Post ReplyReply Direct Link To This Post 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.

Back to Top
pk55 View Drop Down
Senior Member
Senior Member


Joined: 22-Jul-2009
Location: CA
Posts: 105
Post Options Post Options   Quote pk55 Quote  Post ReplyReply Direct Link To This Post 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 :-)
Back to Top
kimj View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 1391
Post Options Post Options   Quote kimj Quote  Post ReplyReply Direct Link To This Post Posted: 23-Aug-2009 at 6:25pm
This will be fixed in the 5.2.2 release, due the first week of September.
Back to Top
pk55 View Drop Down
Senior Member
Senior Member


Joined: 22-Jul-2009
Location: CA
Posts: 105
Post Options Post Options   Quote pk55 Quote  Post ReplyReply Direct Link To This Post Posted: 24-Aug-2009 at 11:56am
Thanks Kim.  That's great.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down