private void ReadShadowedProfile(string registration) { var config = ConfigLoader.Find(registration); if (config == null) { return; } // We skip the profile validation here. If fuel, takeoff or landing profile // cannot be found, they will appear as 'None' when user edits it. profiles.AcConfigs.Add(config); }
/// <summary> /// 数据库表配置加载器 /// </summary> public void ConfigLoaderDemo() { // 创建一个加载器 // var loader = dbHelper.CreateConfigLoader<TestConfig>("SELECT * FROM tb_configs WITH(NOLOCK)"); var loader = new ConfigLoader <TestConfig>(dbHelper, "SELECT * FROM tb_configs WITH(NOLOCK)"); // 遍历配置 for (int i = 0, len = loader.Configs.Length; i < len; i++) { // do something } // 根据主键查找某一个配置 var config = loader.Find(1); Console.WriteLine("config name:" + config.name); // 重新拉取所有配置 loader.Reload(); }