I’m trying to figure out how to save my sorting in two levels.
My problem is the following:
I have a table with Profiles.
Each Profile has a bunch of Attributes associated to it.
The Attributes are shared among the Profiles (Many-to-Many).
Each Attribute belongs to a Category.
Unfortunately I can’t post an image of my model, need another 9 reputaion points…
What I want to do is group Attributes by Category and, for each Profile, save the order of the Categories and Attributes.
Example:
Platform:
Windows
Mac
Role:
Architect
Developer
Project leader
So here I would like to be able to, for example, change the order of the platforms or have the “role” show up before “Platform”.
I was thinking of adding a seperate table and just saving an array of the CategoryID:s and AttributeID:s for each Profile..
But I’m wondering if there is a better way…
Ok, let’s try again 🙂
I assume you mean you’re trying to preserve the order of entities in a many-to-many relationship?
If so, it seems this isn’t possible with a stadard EF many-to-many join. Instead, you’ll need to add an additional entity in the middle, which stores the sequence. This isn’t elegant, but it’s likely the only way.
Here’s some info from Rowan Miller @ MS:
Source: http://social.msdn.microsoft.com/Forums/en/adonetefx/thread/6fe9f4fc-9979-4885-ad15-8c5ddebb45b1