public void DeleteSync() { ClearDapperCompisiteKeyEntity(); var d1 = CreateDapperCompisiteKeyEntity(); try { _dapper.DeleteAsync(d1).GetAwaiter().GetResult(); var sql = $"select count(*) from dapper_compisite_key where products_id = {d1.products_id} and language_id = {d1.language_id}"; var count = helper.GetValue(sql, Convert.ToInt32); Assert.Equal(count, 0); } finally { ClearDapperCompisiteKeyEntity(); } }
public void DeleteSync() { ClearTestEntity(); try { var d1 = CreateTestEntity(); _dapper.DeleteAsync(new DapperAllTest { Id = d1.Id }).GetAwaiter().GetResult(); var sql = string.Format("select count(*) from DapperAllTest where id = {0}", d1.Id); int count = helper.GetValue(sql, Convert.ToInt32); Assert.Equal(0, count); } finally { ClearTestEntity(); } }
public virtual async Task <bool> DeleteAsync(int id) { var item = repository.FindById(id); return(await repository.DeleteAsync(item)); }