Config/ConfigSourceDynamic.cs

(开头部分) 9KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Reflection;
using System.Collections;
using System.Linq;
using System.Text;

using ComLib.Entities;


namespace ComLib.Configuration
{
    /// <summary>
    /// Config source dynamicall saves all properties that are in this or sub-classed type.
    /// </summary>
    public class ConfigSourceDynamic : IConfigSourceDynamic
    {
        private string _sourcePath;
        private bool _isSourcePathFileBased = false;
        private Func<IConfigSource> _configStoreFactory;
        private IRepository<ConfigItem> _repo;
        private IConfigSource _configStore;


        /// <summary>
        /// Default construction.
        /// </summary>
        public ConfigSourceDynamic()
        {
            string name = this.GetType().Name.Replace("Settings", "");
            SetNames(string.Empty, name);
            Init();
        }


        /// <summary>
        /// Initialize with the reference to source path.
        /// </summary>
        /// <param name="appName">E.g. "MyWebApp"</param>
        /// <param name="configName">E.g. "Dev.config"</param>
        /// <param name="sourcePath">File path or connectionstring</param>
        /// <param name="isSourcePathFileBased">Whether or not the source path is a file path or database connection string.</param>
        public ConfigSourceDynamic( string appName, string configName, string sourcePath, bool isSourcePathFileBased)
        {
            _sourcePath = sourcePath;
            SetNames(appName, configName);
            SetRepository(null, null);
            Init();
        }


        /// <summary>
        /// Initialize w/ lamda factory method for creating the configSourcePersistant
        /// </summary>
        /// <param name="appName">E.g. "MyWebApp"</param>
        /// <param name="configName">E.g. "Dev.config"</param>
        /// <param name="configRepo"></param>
        public ConfigSourceDynamic( string appName, string configName, IRepository<ConfigItem> configRepo)
        {
后面还有 271 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。