There is an unsaved comment in progress. You will lose your changes if you continue. Are you sure you want to reopen the work item?
ConfigurationElementCollection item type has more than one key property
I've spent the last day and half with CSD and I've had pretty good luck converting some custom sections, elements, and element collections. My reason for pursuing this approach is as a workaround to a problem with xsd.exe that Microsoft says they don't
plan to fix (it is no longer possible to generate xsd file from an assembly containing custom configuration types).
I have a configuration element collection that holds instances of a configuration element type that has two key properties (this is intentional). I made this work previously by overriding GetElementKey on the collection class. It looks like CSD is trying to
do the same thing (it overrides GetElementKey and references a property that I can implement in a partial class. So it seems like it ought to work, but I can't get the project to compile. I get the following error messages:
Error 5 The Item Type of this collection has more than one key property.
Error 6 Running transformation: System.InvalidOperationException: Sequence contains more than one element
I can get both error messages to go away if I do not mark both properties as keys, but the generated code won't allow me to override GetElementKey. If I do not mark either properties as a key I can override GetElementKey but I cannot create a configuration
element collection that refers to an item type that doesn't have a key.
Any help would be appreciated. I can send more details if it will help, but I don't think it's difficult to reproduce this scenario.