示例#1
0
 public async Task Delete <T>(Guid id) where T : IEntity
 {
     await Task.Run(() =>
     {
         using var db = new LiteDB.LiteRepository(_connectionString);
         db.Delete <T>(e => e.Id == id);
     });
 }
示例#2
0
 /// <summary>
 /// Deletes customer from database by id.
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public bool Delete(Guid id)
 {
     using (var repo = new LiteDB.LiteRepository(ConnectionString))
     {
         try
         {
             return(repo.Delete <Customer>(id));
         }
         catch (DbException e)
         {
             throw e;
         }
     }
 }