Ejemplo n.º 1
0
 protected override void DeleteResourceTyped(Guid key)
 {
     using (var model = new ResourcesModelContainer())
     {
         DeleteNoSave(key, model, typeof(T));
         model.SaveChanges();
     }
 }
Ejemplo n.º 2
0
 protected override void WriteResourceTyped(Guid key, T resource)
 {
     Debug.Assert(resource is BaseEntity);
     using (var model = new ResourcesModelContainer())
     {
         WriteNotSave(key, resource, model, typeof(T));
         model.SaveChanges();
     }
 }
Ejemplo n.º 3
0
 private void WriteSeria(IEnumerable <Tuple <UnactualResourceContent, object> > objects)
 {
     using (var model = new ResourcesModelContainer())
     {
         foreach (var objs in objects.GroupBy(k => k.Item1.ResourceName))
         {
             var type = _pool.GetTypeByName(objs.Key);
             foreach (var writingObject in objs)
             {
                 var key = writingObject.Item1.ResourceKey;
                 if (writingObject.Item2 == null)
                 {
                     DeleteNoSave(key, model, type);
                 }
                 else
                 {
                     WriteNotSave(key, writingObject.Item2, model, type);
                 }
             }
         }
         model.SaveChanges();
     }
 }
Ejemplo n.º 4
0
 public static void SetValue(string category, string section, string key, object value)
 {
     var db = new ResourcesModelContainer();
     db.Settings.MergeOption = System.Data.Objects.MergeOption.OverwriteChanges;
     var item = db.Settings.FirstOrDefault(x => x.CultureCode == "en" & x.Category == category & x.Section == section & x.KeyName == key);
     if (item == null)
     {
         item = new Setting();
         item.Category = category;
         item.Section = section;
         item.KeyName = key;
         db.Settings.AddObject(item);
     }
     item.KeyValue = value.ToString();
     if (value == null)
     {
         item.KeyType = "";
     }
     else
     {
         item.KeyType = value.GetType().Name;
     }
     db.SaveChanges();
 }