« Unit of Work Pattern » : différence entre les versions
Apparence
Page créée avec « Category:Design Pattern Category:.NET Core = Links = * = Description = Used to manage transactions and ensure data consistency across multiple operations.<br> Key Components and Benefits: * Transaction Management: ensures that multiple database operations are treated as a single transaction. This means that either all operations succeed or none of them do, maintaining data integrity and consistency. * Repository Coordination: It coordinates the work of... » |
|||
Ligne 13 : | Ligne 13 : | ||
= Implementation = | = Implementation = | ||
<filebox fn='UnitOfWork.cs'> | <filebox fn='UnitOfWork.cs' collapsed> | ||
public class UnitOfWork : IUnitOfWork, IDisposable | public class UnitOfWork : IUnitOfWork, IDisposable | ||
{ | { |
Version du 9 mars 2025 à 11:49
Links
Description
Used to manage transactions and ensure data consistency across multiple operations.
Key Components and Benefits:
- Transaction Management: ensures that multiple database operations are treated as a single transaction. This means that either all operations succeed or none of them do, maintaining data integrity and consistency.
- Repository Coordination: It coordinates the work of multiple repositories by using a shared database context. This allows for efficient management of complex transactions involving multiple entities.
- Scalability: As the number of repositories increases, it helps manage complexity by ensuring all operations participate in the same transaction.
- Persistence Ignorance: It abstracts the underlying data access technology, allowing developers to switch between different data access frameworks like EF Core, Dapper, or ADO.NET without affecting the business logic.
Implementation
UnitOfWork.cs |