Is there a way to implement transactions in code first without having to write stored procedures?
I have some scenarios where multi-table entries need to be created with unique guids before a final table entry can be created. Is this something I can code using EF alone?
DbContext.SaveChanges()method uses a transaction . So it is Atomic and you don’t want to use stored procedures. The unitOfWork patter is implemented in EF itself to accomplish this.But let’s say you are using two DbContext instances to d your job , then you need to wrap your work with a transaction scope like this,
See the documentation