Configuration Collection of type 'AddRemoveClearMap': why do children need a key property?

Dec 17, 2012 at 12:07 PM
Edited Dec 17, 2012 at 12:09 PM

[This question originally asked on, but got no attention there]


I'm using Configuration Section Designer (CSD) to manage my .NET app.config file structure, and so far I'm lovin' it.

Problem is, I need a collection of items that doesn't lend itself to having a key. This is a list of permissions having a type {User | Group} and a name. There can be several items of the same type and several items of the same name.

It makes sense not to be able to do this using a collection of type BasicMap; but what about AddRemoveClearMap collections? (Ok, the 'map' in AddRemoveClearMap doesn't help, I need list semantics).

This is what CSD says when I try to configure it like this:

The Item Type of this collection does not have a key property.

Here's a screenshot.

Any pointers are welcome.

PS. This StackOverflow answer suggests I add a bogus (unique) GUID property to the objects in the collection and use that as the key. Is there a way to bend CSD to allow that, short of editing the CSD source code?

Dec 17, 2012 at 2:39 PM

Thank you for the comment. This is currently an active work item for this project, so will hopefully be completed soon.

Dec 17, 2012 at 4:42 PM

I have applied a user submitted patch that may help with this issue. I've uploaded the source code. If no issues found, we will include this in next build.

Dec 18, 2012 at 9:43 AM

Is this tracked somewhere? Can you share a link to the bug/patch/...? Need a beta-tester? B-) 

Dec 18, 2012 at 7:20 PM

I had to rollback the changes temporarily due to some issues. We will let you know when it is ready.

Dec 19, 2012 at 3:12 PM

IlMax is now working on this one.

Jan 7, 2013 at 10:58 PM

I'll fix it during this week (i hope)

Jul 15, 2013 at 3:24 PM
Any news on this?
Jul 15, 2013 at 3:39 PM
Looks like @iLMaX added the patch for this in March -

Unfortunately, the latest release is from January. Could you please create another release to include this?
Jul 15, 2013 at 4:51 PM
Edited Jul 15, 2013 at 4:52 PM
Compiled from source and tested in VS2012. Happy to report that it seems to work just fine :)

Thanks iLMaX! I'd buy you a beer for this!

The enhancement can be found in the properties for "Configuration Element Collection" types as the new property "Use Hash For Element Key"
Jul 15, 2013 at 4:53 PM
fdsaasdf wrote:
Compiled from source and tested in VS2012. Happy to report that it seems to work just fine :)

Thanks iLMaX! I'd buy you a beer for this!
Waiting for the beer :)
Jul 26, 2013 at 9:46 PM
Awesome change, just remember that you have to override the GetHashCode method on your custom configuration element when using it (thank god for partial classes)
Jul 27, 2013 at 12:21 AM
Why does GetHashCode() need to be overridden?
Jul 27, 2013 at 12:33 AM
@iLMaX: I'll make true on my promise :) Got a PayPal account or smth?