Cannot remove ManyToMany item

Discussion of open issues, suggestions and bugs regarding LinqConnect – Devart's LINQ to SQL compatible ORM
Post Reply
keeper
Posts: 17
Joined: Mon 27 Dec 2010 09:20

Cannot remove ManyToMany item

Post by keeper » Thu 17 Feb 2011 15:56

Hello, I have two entities: Utente and Gruppo which are ManyToMany related.

In the designer I can create the entities correctly: they are linked with a dotted line showing a "*" on both sides.

When I try to delete a relation this way:

Code: Select all

        public bool RemoveUserFromGroup(string user, string group)
        {
            Utente utente = context.Utenti.SingleOrDefault(u => u.UserName == user);
            Gruppo gruppo = context.Gruppi.SingleOrDefault(g => g.UserGroup == group);
            if (utente == null || gruppo == null) return false;
            utente.Gruppi.Remove(gruppo);
            context.SubmitChanges();
            return true;
        }
I get an exception saying: "Could not modify EntitySet".
What am I doing wrong?
Thanks

StanislavK
Devart Team
Posts: 1710
Joined: Thu 03 Dec 2009 10:48

Post by StanislavK » Fri 18 Feb 2011 15:00

Thank you for the report, we have reproduced the issue. We will analyze it and inform you about the results.

StanislavK
Devart Team
Posts: 1710
Joined: Thu 03 Dec 2009 10:48

Post by StanislavK » Fri 22 Apr 2011 09:38

This problem was caused by incorrect code generation for many-to-many associations. We have fixed it, and the fix is available in the latest 2.50.22 Beta build of LinqConnect. The new build can be downloaded from
http://www.devart.com/linqconnect/download.html
(the trial version) or from Registered Users' Area (provided that you have an active subscription):
http://secure.devart.com/

For more information about the fixes and improvements available in LinqConnect 2.50 Beta, please refer to
http://www.devart.com/forums/viewtopic.php?t=20827

keeper
Posts: 17
Joined: Mon 27 Dec 2010 09:20

Post by keeper » Tue 03 May 2011 09:22

When a final (non-beta) release will be available? I'd rather not install a beta version on a production system...

StanislavK
Devart Team
Posts: 1710
Joined: Thu 03 Dec 2009 10:48

Post by StanislavK » Wed 04 May 2011 10:10

We plan to publish the release in about two weeks. We will post here when it is available.

StanislavK
Devart Team
Posts: 1710
Joined: Thu 03 Dec 2009 10:48

Post by StanislavK » Thu 19 May 2011 11:32

We have released the new 2.50.23 version of LinqConnect. It can be downloaded from
http://www.devart.com/linqconnect/download.html
(the trial version) or from Registered Users' Area (for users with active subscription only):
http://secure.devart.com/

For the detailed information about the improvements and fixes available in LinqConnect 2.50.23, please refer to
http://www.devart.com/forums/viewtopic.php?t=21036

Post Reply