Beispiel #1
0
        public static Code LoadSingle(long userId, string tableName, string codeName, bool notFromCache = false)
        {
            var toRet = new Code {
                TableName = tableName, CodeName = codeName
            };

            if (!CacheHelper.Get(Module + "_" + toRet.TableName + "_" + toRet.CodeName, out toRet) || notFromCache)
            {
                var codeRepository = new CodeRepository();
                toRet = codeRepository.LoadSingle(tableName, codeName);
                if (toRet != null)
                {
                    if (tableName == "_System" && codeName == "DefaultTimeOut")
                    {
                        CacheHelper.Add(Module + "_" + toRet.TableName + "_" + toRet.CodeName, toRet, Convert.ToInt32(toRet.Value1));
                    }
                    else
                    {
                        CacheHelper.Add(Module + "_" + toRet.TableName + "_" + toRet.CodeName, toRet, BlCommon.DefaultTimeOut());
                    }
                }
            }
            return(toRet);
        }