Skip to content
This repository was archived by the owner on May 9, 2020. It is now read-only.
This repository was archived by the owner on May 9, 2020. It is now read-only.

Transaction not working ? #52

@Herium

Description

@Herium

Need to work with transactions , but not working, if i remove transaction code ,works fine

var sms = this.DbContext.SMS.Find(id);
            if (this._validation.DeleteValidation(httpContext, id))
            {
                using (var dbContextTransaction = this.DbContext.Database.BeginTransaction())
                {
                    this.DbContext.SMS.Remove(sms);


                    if (this.DbContext.SaveChanges() == 1)
                    {
                       //error here says the transaction does not exists anymore
                        dbContextTransaction.Commit();
                        return true;
                    }
                    dbContextTransaction.Rollback();
                }
                
            }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions