如何使 FreeSql 和 CAP 进行集成 #1202
yang-xiaodong
started this conversation in
General
Replies: 2 comments 16 replies
-
每次CreateDbContext后,TraceAfter 事件 是否会重复绑定 |
Beta Was this translation helpful? Give feedback.
13 replies
-
替换 MySqlCapTransaction --> PostgreSqlCapTransaction 即可。 |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
本文用于描述如何使用 FreeSql 和 CAP 进行事务集成。
背景描述
在CAP中,事务对象需要交给CAP进行提交从而在事务实现提交后对缓存消息到 Broker 的 Flush 动作,而目前的Orm大部分都有自己的事务管理对象进行事务的提交。CAP官方直接原生支持使用 ADO.NET 和 EntityFrameworkCore 进行事务集成,而对于第三方ORM本文提供了一种扩展用以集成的示例。
示例
以下为在 FreeSql 中和 CAP 进行集成的示例:
1. FreeSql Repository+UnitOfWork 事务模式
使用方式:
2. FreeSql DbContext 事务模式
此扩展方式不支持使用
dbContext.UnitOfWork.Orm
Api 来获得IFreeSql
对象,请直接通过 dbContext 来获取。使用示例
Beta Was this translation helpful? Give feedback.
All reactions