Пример #1
0
        // return from cache or select from store
        public T SelectById <T>(string id)
        {
            T model;

            //var objStr = _cache.Select(id);

            //if (objStr == null)
            //{
            // var objType = typeof(T);
            //var prop = objType.GetProperty("cachettl");

            model = _dbase.SelectById <T>(id);

            //if (model != null)
            //{
            //    objStr = ModelManager.ModelToJson(model);
            //    var cachettl = (int)prop.GetValue(model);
            //    _cache.Insert(id, objStr, cachettl);
            //}
            //}
            //else
            //{
            //    model = ModelManager.JsonToModel<T>(objStr);
            //}

            return(model);
        }
Пример #2
0
        public Profile GetById(string id)
        {
            Profile profile = null;

            try
            {
                profile = _dbase.SelectById <Profile>(id);;
            }
            catch (Exception err)
            {
                throw new Exception(Errors.ERR_PROFILE_BADREQUEST, err);
            }

            return(profile);
        }