Print Page | Close Window

Strange Reject Changes Behaviour

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=2333
Printed Date: 02-Sep-2025 at 2:57pm


Topic: Strange Reject Changes Behaviour
Posted By: tersiusk
Subject: Strange Reject Changes Behaviour
Date 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 - uploads/988/Sample.rar




Replies:
Posted By: sbelini
Date 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.



Print Page | Close Window