Exemplo n.º 1
0
        public static T Restore(string in_name)
        {
            if (string.IsNullOrEmpty(in_name))
            {
                return(null);
            }
            string name = in_name.ToUpper();

            foreach (T o in _cache)
            {
                if (o.Name.ToUpper() == name)
                {
                    return(o);
                }
            }
            DataRow r = new GetObjectSql(in_name).Execute();

            if (r == null)
            {
                return(null);
            }
            T res = new T();

            _cache.Add(res);
            res.FillProps(r);
            res.SetStorageConsistency();
            return(res);
        }
Exemplo n.º 2
0
        public static T Restore(int?in_id)
        {
            if (!in_id.HasValue)
            {
                return(null);
            }
            foreach (T o in _cache)
            {
                if (o.Id == in_id.Value)
                {
                    return(o);
                }
            }
            DataRow r = new GetObjectSql(in_id.Value).Execute();

            if (r == null)
            {
                return(null);
            }
            T res = new T();

            _cache.Add(res);
            res.FillProps(r);
            res.SetStorageConsistency();
            return(res);
        }