0

I have an IBException error when I am trying to delete. Insert is working, but Update and Delete are not. I used InterBaseSql. EntityFrameworkCore. InterBase version 7.13.7 I am stuck with this error. If anyone could help me, I would appreciate it. Thank you.

  public async Task Delete(long id, ContextSession session)
{
    var context = GetContext(session);

    using (IDbContextTransaction transaction = context.Database.BeginTransaction())
    {
        try
        {

            var itemToDelete = context.Table.Find(id);
            //context.Table.Remove(itemToDelete);
            context.Entry(itemToDelete).State = EntityState.Deleted;
          
            await context.SaveChangesAsync();
            await transaction.CommitAsync();
        }
        catch (Exception ex)
        {
            transaction.Rollback();
            Console.WriteLine("Error occurred.");
        }
    }
}

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.