New Posts New Posts RSS Feed: Strange Reject Changes Behaviour
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Strange Reject Changes Behaviour

 Post Reply Post Reply
Author
tersiusk View Drop Down
Newbie
Newbie
Avatar

Joined: 03-Nov-2010
Posts: 20
Post Options Post Options   Quote tersiusk Quote  Post ReplyReply Direct Link To This Post Topic: Strange Reject Changes Behaviour
    Posted: 24-Nov-2010 at 12:41am
Hi the following code causes a primary key constraint exception in the database since it for some reason wants to insert another application record which is not right.

 var application = DemoDBEntities.DefaultManager.Applications.FirstOrDefault();

//Comment out this code to make the role addition work.
// --------------------------------------------------
User user = DemoDBEntities.DefaultManager.CreateEntity<User>();
DemoDBEntities.DefaultManager.AddEntity(user);
user.UserID = Guid.NewGuid();
user.FirstName = "First Name";
user.Applications.Add(application);
DemoDBEntities.DefaultManager.RejectChanges();
DemoDBEntities.DefaultManager.SaveChanges(); //Save does not throw an excepton.
//--------------------------------------------------

var role = DemoDBEntities.DefaultManager.CreateEntity<Role>();
var systemFunction = DemoDBEntities.DefaultManager.SystemFunctions.FirstOrDefault();
role.SystemFunctions.Add(systemFunction);
role.Name = "Name";
role.Description = "Description";
role.RoleID = Guid.NewGuid();
role.Application = application;
DemoDBEntities.DefaultManager.SaveChanges();

The sample application and SQL script for the database : uploads/988/Sample.rar



Edited by tersiusk - 24-Nov-2010 at 12:47am
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: 24-Nov-2010 at 2:56pm
Hi tersiusk,
 
This issue has already been taken care of and the fix will be present in DevForce2010 6.0.7.0
 
Regards,
   sbelini.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down