Vote count:
1
I'm using ASP.NET MVC and EF 6 and I have a controller that calls my service layer to perform some actions. One of those actions must be async so the controller can return a view before that action is complete. This is how it looks:
- Controller action being executed.
- Invoke Service.
- Service performs some actions that save data in the DB.
- Services starts a new task (Task.Factory.StartNew(() => X()) and return control to the Controller.
- Controller calls another service that tracks user actions. This is where it fails because the async operation I started on (4) uses a transaction and they are sharing the same DbContext.
How should I handle this?
asked 1 min ago
Entity Framework 6: async, sync and transactions
Aucun commentaire:
Enregistrer un commentaire