public T GetById <T>(int id) where T : BaseEntity
        {
            // check query cache before hitting db.
            //if (_db.QueryCache.GetCache(id, out value))
            //    return value;
            var builder = new SqlQueryBuilder <T>();

            builder.SelectTopStar(1).From(TableName, Schema).Where(t => t.Id).EqualTo(id);

            var value = LoadSingle(builder);

            //if (value != null)
            //    _db.QueryCache.SetCacheItem(id, value);
            return(value);
        }