Exemplo n.º 1
0
        public PersonCollection FetchByID(object ID, bool cached)
        {
            if (!cached)
            {
                return(FetchByID(ID));
            }
            string cacheKey = (typeof(Person)).ToString() + "-" + ID;
            Cache  cache    = HttpRuntime.Cache;

            if (cache[cacheKey] != null)
            {
                return(cache[cacheKey] as PersonCollection);
            }

            PersonCollection coll = new PersonCollection().Where(Person.Columns.ID, ID).Load();

            cache.Insert(cacheKey, coll, null,
                         DateTime.Now.AddMinutes(5), TimeSpan.Zero);
            return(coll);
        }
Exemplo n.º 2
0
        public PersonCollection FetchByID(object ID)
        {
            PersonCollection coll = new PersonCollection().Where("ID", ID).Load();

            return(coll);
        }