@@ -897,6 +897,38 @@ public static DomainConfiguration Load(IConfigurationSection configurationSectio
897897 Strings . ExConfigurationForDomainIsNotFoundInApplicationConfigurationFile , name , sectionName ) ) ;
898898 }
899899
900+ public static DomainConfiguration Load ( IConfigurationRoot configurationRoot , string name )
901+ {
902+ ArgumentValidator . EnsureArgumentNotNull ( configurationRoot , nameof ( configurationRoot ) ) ;
903+
904+ var jsonParser = new JsonToDomainConfigurationReader ( ) ;
905+ var xmlParser = new XmlToDomainConfigurationReader ( ) ;
906+
907+ var parseResult = jsonParser . Read ( configurationRoot , name ) ;
908+ if ( parseResult != null )
909+ return parseResult ;
910+ parseResult = xmlParser . Read ( configurationRoot , name ) ;
911+ if ( parseResult != null )
912+ return parseResult ;
913+
914+ throw new InvalidOperationException ( string . Format (
915+ Strings . ExConfigurationForDomainIsNotFoundInApplicationConfigurationFile , name , sectionName ) ) ;
916+ }
917+
918+ public static DomainConfiguration Load ( IConfigurationRoot configurationRoot , string sectionName , string name )
919+ {
920+ ArgumentValidator . EnsureArgumentNotNull ( configurationRoot , nameof ( configurationRoot ) ) ;
921+
922+ var jsonParser = new JsonToDomainConfigurationReader ( ) ;
923+ var xmlParser = new XmlToDomainConfigurationReader ( ) ;
924+
925+ var parseResult = jsonParser . Read ( configurationRoot , sectionName , name ) ;
926+ if ( parseResult != null )
927+ return parseResult ;
928+ parseResult = xmlParser . Read ( configurationRoot , sectionName , name ) ;
929+ if ( parseResult != null )
930+ return parseResult ;
931+
900932 throw new InvalidOperationException ( string . Format (
901933 Strings . ExConfigurationForDomainIsNotFoundInApplicationConfigurationFile , name , sectionName ) ) ;
902934 }
0 commit comments