/// <summary> /// 从仓储中获取配置对象 /// </summary> public virtual void Get() { ConfigurationBase config = repository.Get(ConfigKey, this.GetType()); if (config == null) { config = GetDefaultConfig() as ConfigurationBase; } if (config == null) { throw new InvalidOperationException("无法获取配置数据,且未设置默认配置数据"); } CopyFrom(config); }
/// <summary> /// 将指定的配置对象属性拷贝到当前实例中 /// </summary> /// <param name="sourceConfig">原配置</param> public abstract void CopyFrom(ConfigurationBase sourceConfig);