| 1234567891011121314151617181920212223242526 |
- using Quadarax.Foundation.Core.Data.Interface.Domain;
- using Quadarax.Foundation.Core.Object;
- namespace Quadarax.Foundation.Core.Data.Domain
- {
- public class UnitOfWork<TDomainContext> : DisposableObject, IUnitOfWork<TDomainContext> where TDomainContext : IDomain
- {
- public TDomainContext Context { get; protected set; }
- public UnitOfWork(IDomainContextResolver<TDomainContext> context)
- {
- Context = context.GetCurrent<TDomainContext>();
- }
- public void Commit()
- {
- Context?.Commit();
- }
- protected override void OnDisposing()
- {
- Context = default!;
- }
- }
- }
|