Esempio n. 1
0
File: Sync.cs Progetto: xhute/Kooboo
        public static TableSetting GetTableSetting(Database db)
        {
            var list = db.GetTables();

            list.RemoveAll(o => o.StartsWith("_sys_"));

            TableSetting setting = new TableSetting();

            foreach (var item in list)
            {
                var table = db.GetOrCreateTable(item);
                setting.tables.Add(item, table.Setting.Columns);
            }
            return(setting);
        }
Esempio n. 2
0
        public static void SetTableSetting(Database db, TableSetting setting)
        {
            if (setting != null && setting.tables != null && setting.tables.Count > 0)
            {
                foreach (var item in setting.tables)
                {
                    var tablesetting = new Setting()
                    {
                        Columns = item.Value
                    };

                    var cloned = Dynamic.SettingHelper.Clone(tablesetting);

                    var table = db.GetOrCreateTable(item.Key, tablesetting);
                    table.UpdateSetting(cloned);
                }
            }
        }