New Posts New Posts RSS Feed: Many To Many Collection bug
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Many To Many Collection bug

 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: Many To Many Collection bug
    Posted: 17-Nov-2010 at 2:39am
Hi 

I have found a possible bug in a Many To Many scenario. The following code throws the following exception. 
Violation of PRIMARY KEY constraint 'PK_SystemFunctions'. Cannot insert duplicate key in object 'dbo.SystemFunctions'.
I merely remove an entity and then add another entity and then add the removed enitity again. This is not suppose to trigger any inserts since the record was not deleted but only removed and added in memory. Also when I use only EF the error goes away and it works.
 var role = DemoDBEntities.DefaultManager.Roles.Where(r => r.Name == "RoleA").FirstOrDefault();

var remSystemfunction = role.SystemFunctions[0];

var systemFunctionToAdd = DemoDBEntities.DefaultManager.SystemFunctions.
                Where(sf => sf.Name == "SystemFunctionC").FirstOrDefault();

role.SystemFunctions.Remove(remSystemfunction);
role.SystemFunctions.Add(systemFunctionToAdd);
role.SystemFunctions.Add(remSystemfunction);

DemoDBEntities.DefaultManager.SaveChanges();
I have attached a sample project along with a sql file to generate the database and some dummy records.
uploads/988/ManyToManyBug.rar
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: 17-Nov-2010 at 3:20pm
Hi tersiusk,
 
I verified the behavior you stated.
I am filing a bug an will follow up with you once the issue is fixed.
 
sbelini.
Back to Top
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 Posted: 17-Nov-2010 at 11:00pm
Thanks, do you have any idea how long it will take to get this fixed?
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: 19-Nov-2010 at 9:04am
Hi Tersius,
 
The fix will be available in DevForce 6.0.7 which will be released early in December.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down