New Posts New Posts RSS Feed: EntitySaveOperation.Cancelled is true
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

EntitySaveOperation.Cancelled is true

 Post Reply Post Reply
Author
danjal View Drop Down
Groupie
Groupie


Joined: 20-Sep-2010
Posts: 43
Post Options Post Options   Quote danjal Quote  Post ReplyReply Direct Link To This Post Topic: EntitySaveOperation.Cancelled is true
    Posted: 18-Jan-2011 at 4:05am

I have an entity of type Theme and another entity of type User.

My theme entity has a list of users that have access to this theme.

 

I add a new user to have access to a theme like this:

 

p_currentTheme.p_usersWithAccess.Add(newValue);

p_currentTheme.EntityAspect.SetModified();

 

This works fine in cache, but when saving the changes to the database, I see that EntitySaveOperation.Cancelled gets set to true. Is there any way to debug this further to see what is actually wrong?

 

Back to Top
smi-mark View Drop Down
DevForce MVP
DevForce MVP
Avatar

Joined: 24-Feb-2009
Location: Dallas, Texas
Posts: 343
Post Options Post Options   Quote smi-mark Quote  Post ReplyReply Direct Link To This Post Posted: 18-Jan-2011 at 9:21am
How is newValue being instantiated? You certainly don't want to be calling "SetModified" are you adding this new user to the entity manager cache?
Back to Top
sbelini View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 13-Aug-2010
Location: Oakland
Posts: 786
Post Options Post Options   Quote sbelini Quote  Post ReplyReply Direct Link To This Post Posted: 18-Jan-2011 at 4:10pm
Hi danjal,
 
Why are you setting p_currentTheme to modified? (There is no need to do that)
 
When you add/remove a child_entity to/from a parent_entity's navigation property, the parent_entity's state remains Unchanged and only the child_entity's state is set to Modified (or remains/is set to Added, if the child_entity is a new entity)
 
 
sbelini
Back to Top
danjal View Drop Down
Groupie
Groupie


Joined: 20-Sep-2010
Posts: 43
Post Options Post Options   Quote danjal Quote  Post ReplyReply Direct Link To This Post Posted: 19-Jan-2011 at 2:32am

We found something interesting yesterday!

I do not know if this is a DevForce issue or a Informix database issue.

 

We have experienced huge problems when adding/removing child entities to/from a parent entity´s navigation property and subsequently saving to the database.

 

The interesting bit that we have found is that this problems can have something to do with the fact that if the parent entity has fields that are set to Nullable = false and that these fields are empty when we save, the save operation gets cancelled without any error or exception – in some cases we are only interested in updating the parent navigation property.

Does anyone have any input one this?

 

Setting the parent entity to SetModified is my attempt to hammer at everything to gets things working/response J sorry.

Back to Top
sbelini View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 13-Aug-2010
Location: Oakland
Posts: 786
Post Options Post Options   Quote sbelini Quote  Post ReplyReply Direct Link To This Post Posted: 20-Jan-2011 at 5:01pm
Hi danjal,
 
I'm working on getting informix working with VS2010/DevForce2010.
 
Once I get this working, I will run some tests and figure out what's going on.
 
It's still unclear to me why you are using SetModified. What do you mean by "get things working/response"?
Back to Top
sbelini View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 13-Aug-2010
Location: Oakland
Posts: 786
Post Options Post Options   Quote sbelini Quote  Post ReplyReply Direct Link To This Post Posted: 20-Mar-2011 at 10:16pm
I was not able to reproduce this issue.
I tried adding/deleting orders from employees and or customers but had no issues.
I created a model similar to NorthwindIB (the difference is that CustomerID is Serial instead of Guid) to test it.
Can you provide a test case reproducing the problem?
Silvio.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down