Hello,
I have few configuration files (these were stored in SSO earlier, we have exported these into XML files and like to read from there). Enterprise Library Configuration was used to read this earlier. Now as there is no enterprise library available for .netcore we have to find another way to read it.
Configuration file looks like
<SerializableConfigurationSection><RequestSettings><clear /><add name="ABC" Action="ABC" Scheme="ABC" Type="ABC" SourceSystem="ABC" Channel="ABC" Code="ABC" /></RequestSettings><MessageSettings><clear /><add name="ABC" Action="ABC" ProcessVersion="1.0" PlatformName="ABC" Priority="ABC" Validator="ABC" Command="ABC" /></MessageSettings><FileImportSettings><clear /><add name="ABC" Description="ABC" Channel="ABC" ProcessVersion="1.0" FileNameRegex="ABC" FileExtension="ABC" InboundFolder="ABC" DuplicateFolder="ABC" FailedFolder="ABC" ArchiveFolder="ABC" FileParser="ABC" EncodingName="ABC" /></FileImportSettings></SerializableConfigurationSection>
Equivalent class has 3 elements
public ICollection<RequestSettingsElement> RequestSettings { get { return (ICollection<RequestSettingsElement>)base["RequestSettings"]; } } public ICollection<MessageSettingsElement> MessageSettings { get { return (ICollection<MessageSettingsElement>)base["MessageSettings"]; } } public ICollection<FileImportSettingsElement> FileImportSettings { get { return (ICollection<FileImportSettingsElement>)base["FileImportSettings"]; } }
EnterpriseLibrary configuration classes were populating this class. Now I want to populate this with another method. I tried de-serialising xml to this class (after converting ICollection to Collection/ List) but all elements remain null.
Would someone advise me how to read this file into a class (i.e. de-serialise it)?
Or any alternate way.
Regards,