Example #1
0
        public override PetModel Get(long id)
        {
            PetModel model = GetCache(id.ToString());

            if (model == null)
            {
                model = ToModel(SimpleCRUD.Get <Pet>(_connection, id));
                UpdateCache(model, id.ToString());
            }
            return(model);
        }
        /// <summary>
        /// By default queries the table matching the class name.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="id"></param>
        /// <returns></returns>
        public T Get <T>(object id)
        {
            SetSimpleCRUD();

            using (var conn = new SqlConnection(_connectionString))
            {
                conn.Open();
                T ret = _simpleCRUD.Get <T>(conn, id);
                conn.Close();
                return(ret);
            }
        }
Example #3
0
        public override PetOwner Get(long id)
        {
            PetOwner model = GetCache(id.ToString());

            if (model == null)
            {
                var person = SimpleCRUD.Get <Person>(_connection, id);
                if (person != null)
                {
                    model = ToModel(person, GetPetsForOwner(id));
                    UpdateCache(model, model.Id.ToString());
                }
            }
            return(model);
        }
Example #4
0
 public Genre GetGenre(int genreId)
 {
     return(SimpleCRUD.Get <Genre>(Connection, genreId));
 }
 public virtual TModel Get(object id, IDbTransaction transaction = null, int?commandTimeout = null)
 {
     return(SimpleCRUD.Get <TModel>(_connection, id, transaction, commandTimeout));
 }