예제 #1
0
 public static void SaveConfig(DynamicConfig config)
 {
     Instance = config;
     using (var db = new ZkDataContext())
     {
         config.Key             = 1;
         db.Entry(config).State = EntityState.Modified;
         db.SaveChanges();
     }
 }
예제 #2
0
 static DynamicConfig()
 {
     using (var db = new ZkDataContext())
     {
         Instance = db.DynamicConfigs.FirstOrDefault();
         if (Instance == null)
         {
             Instance = new DynamicConfig();
             db.DynamicConfigs.Add(Instance);
             db.SaveChanges();
         }
     }
 }