/// <summary>
        /// Deletes a record or records in the database that match the object passed in.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="entityToDelete"></param>
        /// <returns></returns>
        public int Delete <T>(T entityToDelete)
        {
            SetSimpleCRUD();

            int ret = 0;

            using (var conn = new SqlConnection(_connectionString))
            {
                conn.Open();
                ret = _simpleCRUD.Delete <T>(conn, entityToDelete);
                conn.Close();
            }
            return(ret);
        }
示例#2
0
 public override void Delete(long id)
 {
     SimpleCRUD.Delete <long>(_connection, id);
     RemoveFromCache(new PetModel(), id.ToString());
 }
示例#3
0
 public override void Delete(long id)
 {
     DeletePetsForOwner(id);
     SimpleCRUD.Delete <Person>(_connection, id);
     RemoveFromCache(new PetOwner(), id.ToString());
 }
 public virtual int Delete(TModel entityToDelete, IDbTransaction transaction = null, int?commandTimeout = null)
 {
     return(SimpleCRUD.Delete <TModel>(_connection, entityToDelete, transaction, commandTimeout));
 }