HowTo update/modify LINQ EntitySet?

It appears that I have to do it manually. I mean first delete the relationships (EntitySet): The EntitySet is user. UserActions DataBaseContext.UserActions.

DeleteAllOnSubmit(user. UserActions); DataBaseContext.SubmitChanges() And after that, assign the "new" EntitySet: user.UserActions. Assign(GetSelectedActions()); DataBaseContext.SubmitChanges() I made it work doing that but... DO I have to apply 2 SubmitChanges() to database?

Isn't it a better way to do it?

It appears that I have to do it manually. I mean first delete the relationships (EntitySet): //The EntitySet is user. UserActions DataBaseContext.UserActions.

DeleteAllOnSubmit(user. UserActions); DataBaseContext.SubmitChanges(); And after that, assign the "new" EntitySet: user.UserActions. Assign(GetSelectedActions()); DataBaseContext.SubmitChanges(); I made it work doing that but... DO I have to apply 2 SubmitChanges() to database?

Isn't it a better way to do it?

No man that didn't work it keeps throwing this ex: "Cannot add an entity with a key that is already in use. " – Carlos Castillo Feb 24 '10 at 1:30.

You need this set and the classes regenerating to resolve this.

In my LINQ to SQL generated classes I have some classes containing EntitySets. Everything looks great until I need to modify the EntitySet (add, delete some relationships). Then when I try to submit changes, I may get a duplicate key exception, that means it is not clearing the old actions before assigning the new ones and some of them may be repeated; do I have to do it manually?

What is the best way to do this (update the EntitySet)?

It appears that I have to do it manually. I mean first delete the relationships (EntitySet).

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions