Ejemplo n.º 1
0
 public static void Load(LightDBMapper mapper, bool failException)
 {
     try
     {
         if (EnableCaching && mapper.SupportsCaching && mapper.LoadCache())
         {
             return;
         }
         mapper.Fetch();
         if (!EnableCaching || !mapper.SupportsCaching)
         {
             return;
         }
         log.Info("Saving cache for: " +
                  mapper.Mapping.DataHolderDefinitions
                  .ToString(", "));
         mapper.SaveCache();
     }
     catch (Exception ex)
     {
         if (failException)
         {
             throw new ContentException(ex, "Unable to load entries using \"{0}\"", (object)mapper);
         }
     }
 }
Ejemplo n.º 2
0
 public static void Load(LightDBMapper mapper, bool failException)
 {
     try
     {
         if (ContentMgr.EnableCaching && mapper.SupportsCaching && mapper.LoadCache())
         {
             return;
         }
         mapper.Fetch();
         if (!ContentMgr.EnableCaching || !mapper.SupportsCaching)
         {
             return;
         }
         ContentMgr.log.Info("Saving cache for: " +
                             ((IEnumerable <DataHolderDefinition>)mapper.Mapping.DataHolderDefinitions)
                             .ToString <DataHolderDefinition>(", "));
         mapper.SaveCache();
     }
     catch (Exception ex)
     {
         if (failException)
         {
             throw new ContentException(ex, "Unable to load entries using \"{0}\"", new object[1]
             {
                 (object)mapper
             });
         }
     }
 }
Ejemplo n.º 3
0
        public static void Load(LightDBMapper mapper, bool failException)
        {
            try
            {
                if (EnableCaching && mapper.SupportsCaching)
                {
                    if (mapper.LoadCache())
                    {
                        // loaded cache successfully
                        return;
                    }
                }

                //Utility.Measure("Loading content from DB - " + mapper + "", 1, () => {
                mapper.Fetch();
                //});

                if (EnableCaching && mapper.SupportsCaching)
                {
                    log.Info("Saving cache for: " + mapper.Mapping.DataHolderDefinitions.ToString(", "));
                    mapper.SaveCache();
                }
            }
            catch (Exception e)
            {
                if (failException)
                {
                    throw new ContentException(e, "Unable to load entries using \"{0}\"", mapper);
                }
                // LogUtil.ErrorException(e, "Unable to load entries using \"{0}\"", mapper);
            }
        }