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); } } }
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 }); } } }
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); } }