-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to use transactions #732
Comments
Yes I want to know about this as well. @MikaelHild @iammukeshm could you please suggest how to implement transactionspipeline in dotnet-web-api???? |
Also suggest which nuget package to use for transactions. |
@kienxuandaoit89 you raised this issue last year. Have you found the solution yet??? |
Ardalis specification does not include transactions but can be implemented by using the dbContext, i.e. you could implement your own Repository for the purpose. See this for an example ardalis/CleanArchitecture#327 (comment) |
@MikaelHild error: { Following is my Code:
|
Mukesh have written an article on using Dapper with transactions for this purpose. https://codewithmukesh.com/blog/using-entity-framework-core-and-dapper/ |
Thank you @MikaelHild brother but this still does not solve my problem. I am using Mediatr and mukesh's example shows the solution without mediatr. |
https://github.com/iammukeshm/EFCoreAndDapper Checkout the repo above. It's basically the same but you either have to expose the ApplicationDbContext using an interface in the Application project, or handle the Request in the infrastructure project and use the DbContext to handle the transaction. It could possibly also be solved by using Pipelines in mediator. |
@MikaelHild Could you please correct my code and tell me what could be wrong in it???? |
@MikaelHild I have figured it out. I was opening 2 connections with database where as System.Transaction allows only 1 or if you want to check and validate some value from database you must close the connection first before opening another connection with System.Transaction. |
This issue is resolved so can be closed now. |
Is your feature request related to a problem? Please describe.
How to use transactions with this framework? (example CRUD is used IRepositoryWithEvents)
The text was updated successfully, but these errors were encountered: