patterns-group / code-patterns

Code Patterns: lots of reusable goodies for your .NET project
tribesoftware.org/code-patterns/
BSD 2-Clause "Simplified" License
9 stars 9 forks source link

InMemoryConfigurationSource takes XContainer, but only works with XElement #159

Closed jbatte47 closed 10 years ago

jbatte47 commented 10 years ago

XElement and XDocument both inherit XContainer, and so both produce compiling code when passed as an argument to the InMemoryConfigurationSource.SetConfigurationXml method. This flexibility is not reflected in the section retrieval code, however, as each concrete type has different starting node levels in Linq-to-XML queries, but InMemoryConfigurationSource only has one strategy for dealing with its XContainer; that strategy is only valid for XElement instances. Either some form of type-sensitive solution should be implemented, or the XContainer parameter should be changed to one or the other (XDocument or XElement).