Skip to content

Commit 8ea6642

Browse files
authored
Merge pull request #74 from Ar3sDevelopment/dev
Dev
2 parents 3dfdc2d + d06c93c commit 8ea6642

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

UnitOfWork.NET/Classes/UnitOfWork.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ public class UnitOfWork : IUnitOfWork
1313
{
1414
private readonly ObservableCollection<Assembly> _assemblies;
1515
private readonly IContainer _container;
16+
private readonly ILifetimeScope _scope;
1617

1718
public UnitOfWork()
1819
{
@@ -27,6 +28,7 @@ public UnitOfWork()
2728
cb.RegisterGeneric(typeof(Repository<,,>)).AsSelf().As(typeof(IListRepository<,,>));
2829

2930
_container = cb.Build();
31+
_scope = _container.BeginLifetimeScope();
3032

3133
_assemblies.CollectionChanged += (sender, args) =>
3234
{
@@ -190,6 +192,7 @@ private TRepository GetRepository<TRepository>(bool force = false) where TReposi
190192

191193
public virtual void Dispose()
192194
{
195+
_scope.Dispose();
193196
_container.Dispose();
194197
}
195198
}

0 commit comments

Comments
 (0)