示例#1
0
文件: Setting.cs 项目: 0xF6/X-Sing
 private static void Verify(SingContext db, string key, string value)
 {
     if (!db.Settings.Any(x => x.Key == key))
     {
         return;
     }
     db.Add(new Setting(key, value));
     db.SaveChanges();
 }
示例#2
0
文件: Setting.cs 项目: 0xF6/X-Sing
        public static void Set(string key, string value)
        {
            var ctx = new SingContext();

            if (If(key))
            {
                ctx.Settings.First(x => x.Key == key).Value = value;
                ctx.SaveChanges();
                return;
            }
            Verify(ctx, key, value);
        }