public void Save(params ILocalizedObject[] list)
        {
            _context.Objects.AddOrUpdate(list.Cast <LocalizedObject>().ToArray());
            _context.SaveChanges();

            LocalizationCache.Clear();
        }
        public ILocalizedObject Get(int key)
        {
            var obj = LocalizationCache.Get <ILocalizedObject>(key.ToString());

            if (obj == null)
            {
                obj = _context.Objects.SingleOrDefault(o => o.Key == key);

                LocalizationCache.Set(key.ToString(), obj);
            }

            return(obj);
        }
        public IEnumerable <ILocalizedObject> GetAll(CultureInfo culture)
        {
            var result = LocalizationCache.Get <IEnumerable <ILocalizedObject> >(culture.Name);

            if (result == null || !result.Any())
            {
                result = _context.Objects.Where(obj => obj.LocaleId == culture.LCID && obj.Scope.StartsWith("~/")).ToList();

                LocalizationCache.Set(culture.Name, result);
            }

            return(result);
        }
        public void Delete(params ILocalizedObject[] list)
        {
            foreach (var obj in list)
            {
                var stored = _context.Objects.Where(x => x.Key == obj.Key).FirstOrDefault();
                if (stored != null)
                {
                    _context.Objects.Remove(stored as LocalizedObject);
                }
            }

            _context.SaveChanges();

            LocalizationCache.Clear();
        }