Пример #1
0
        /// <summary>
        /// Called when the configuration source has been requested and must prepare for resolution.
        /// </summary>
        public void Load()
        {
            sync.EnterWriteLock();

            try
            {
                switch (source)
                {
                case XmlSource.File:
                    document = new XmlDocument();
                    document.Load(path.FullName);
                    break;

                case XmlSource.Stream:
                    document = new XmlDocument();
                    document.Load(stream);
                    break;
                }
            }
            catch (Exception ex)
            {
                throw new ConfigurationException($"Cannot load a {source.ToString().ToLower()} XML document", ex);
            }
            finally
            {
                sync.ExitWriteLock();
            }
        }