Aziz Mirzayev
Xozirch Integration testlarini yozib bo'ldim. Bugun bitta muammo chiqdi. Mongodbda auto transaction by default ishlamasakan. Misol db contextga 1 dan ko'p entity change qilinsa xato beryapti. Xozircha Database.AutoTransactionBehavior = AutoTransactionBehavior.Never;…
Use Compensating Actions: If Order fails, delete any saved OrderItems, or mark Order as “incomplete.”
4. Limit SaveChanges Scope: Save only one aggregate root per SaveChanges call to reduce risk.
5. Enable Application-Level Transactions: Wrap SaveChanges in custom logic that ensures consistency across documents.
⸻
🔑 Bottom Line
Setting Database.AutoTransactionBehavior = AutoTransactionBehavior.Never in EF Core MongoDB:
• Removes EF’s guarantee of atomicity.
• Exposes you to partial saves, race conditions, and inconsistencies.
• Makes you responsible for implementing consistency, rollback, and retry logic manually.
• Only safe if your model and operations are naturally idempotent or single-document focused.
4. Limit SaveChanges Scope: Save only one aggregate root per SaveChanges call to reduce risk.
5. Enable Application-Level Transactions: Wrap SaveChanges in custom logic that ensures consistency across documents.
⸻
🔑 Bottom Line
Setting Database.AutoTransactionBehavior = AutoTransactionBehavior.Never in EF Core MongoDB:
• Removes EF’s guarantee of atomicity.
• Exposes you to partial saves, race conditions, and inconsistencies.
• Makes you responsible for implementing consistency, rollback, and retry logic manually.
• Only safe if your model and operations are naturally idempotent or single-document focused.
5 oʻrin oldi mani komandam. Lekin zoʻr boʻldi. 1 martta AWS da ishlashim edi.
https://www.mongodb.com/company/blog/building-with-patterns-the-extended-reference-pattern
Mana shu yaramasni o'qiganimda o'zim bn o'zim 2 hafta olishmasdim MongoDBni tanlashda =)
Mana shu yaramasni o'qiganimda o'zim bn o'zim 2 hafta olishmasdim MongoDBni tanlashda =)
👍1
Bugun rosa qiziq kun bo'ldi. Face detection va face analysis bo'yicha eksperimentlar o'tqazdim. Aaancha bo'lganakan bunaqa ilmiy yondashuv qilmaganimga. Mazza qvordim lekin =)
👍1
Alohida branchda MongoDB driveridan foydalanib qilib ko'rdim. Endi UnitOfWork pattern qo'llab transactionlar bilan ishlidigan qilish kerak. Bitta no tomoni repository implementation Modest.Data projectda servicelar esa Modest.Core da. Xozi shuni qanday amalga oshirishni o'ylab turimman.
PS. Aytgancha testlar uchun replica set qilib ko'tardim.
PSS. EF Core ni transactioni ishlamasakan =)
PS. Aytgancha testlar uchun replica set qilib ko'tardim.
PSS. EF Core ni transactioni ishlamasakan =)
🔥2