public void Dispose() { if (ServiceScope != null) { ServiceScope.Dispose(); } }
private async Task <IActor> CreateSectorAsync(IPerson startPerson, IServiceProvider _globalServiceProvider) { if (ServiceScope != null) { ServiceScope.Dispose(); ServiceScope = null; } ServiceScope = _globalServiceProvider.CreateScope(); ConfigBotAux(); var humanPlayer = _globalServiceProvider.GetRequiredService <HumanPlayer>(); var scoreManager = _globalServiceProvider.GetRequiredService <IScoreManager>(); var sectorManager = ServiceScope.ServiceProvider.GetRequiredService <ISectorManager>(); var playerEventLogService = ServiceScope.ServiceProvider.GetService <IPlayerEventLogService>(); await sectorManager.CreateSectorAsync().ConfigureAwait(false); sectorManager.CurrentSector.ScoreManager = scoreManager; sectorManager.CurrentSector.HumanGroupExit += CurrentSector_HumanGroupExit; var humanActor = CreateHumanActor(humanPlayer, startPerson, sectorManager, playerEventLogService); return(humanActor); }
/// <inheritdoc /> public void Dispose() { if (ShouldDispose) { ServiceScope.Dispose(); } }
public void Dispose() { ScopedBusControl?.StopAsync(); BusControl?.StopAsync(); ServiceScope?.Dispose(); Logger.LogInformation($"{Id} Bus stopped, scope disposed"); }
public void TearDown() { ServiceScope?.Dispose(); if (!string.IsNullOrEmpty(_tempDataDirectory) && Directory.Exists(_tempDataDirectory)) { Directory.Delete(_tempDataDirectory, true); } }
public void Dispose() { if (!_disposed) { _disposed = true; PopNestedServiceScope(); ServiceScope.Dispose(); } }
public void TearDown() { ServiceScope?.Dispose(); ServiceProvider?.Dispose(); if (_temporaryDatabase != null) { var connString = _temporaryDatabase.ConnectionString; _temporaryDatabase = null; FbDatabase.DropDatabase(connString); } }
private IServiceScope CreateScopeInternal() { if (_currentScope != null) { _currentScope.Dispose(); _currentScope = null; GC.Collect(); } _currentScope = new ServiceScope(Instance.CreateChildContainer()); return(_currentScope); }
public void DisposeScopeDisposesContainer() { var container = new Mock <IContainer>(); container.Setup(c => c.Dispose()).Verifiable(); var serviceScope = new ServiceScope(container.Object); serviceScope.Dispose(); container.Verify(); }
public void Dispose_ShouldDisposeLifetimeScope() { // Arrange var lifetimeScopeMock = new Mock<ILifetimeScope>(); var scope = new ServiceScope(lifetimeScopeMock.Object); lifetimeScopeMock.Verify(x => x.Dispose(), Times.Never); // Act scope.Dispose(); // Assert lifetimeScopeMock.Verify(x => x.Dispose(), Times.Once); }
public void Dispose_ShouldDisposeServiceScope() { // Arrange var microsoftServiceScopeMock = new Mock <IServiceScope>(); var scope = new ServiceScope(microsoftServiceScopeMock.Object); microsoftServiceScopeMock.Verify(x => x.Dispose(), Times.Never); // Act scope.Dispose(); // Assert microsoftServiceScopeMock.Verify(x => x.Dispose(), Times.Once); }
public void TearDown() { ServiceScope?.Dispose(); if (!string.IsNullOrEmpty(_tempDataDirectory) && Directory.Exists(_tempDataDirectory)) { try { Directory.Delete(_tempDataDirectory, true); } catch { // Ignore exceptions - we need to find out later why this happens } } }
public void Dispose() { ServiceScope?.Dispose(); ServiceProvider?.Dispose(); }
public virtual void TestCleanup() { ServiceScope.Dispose(); }
public virtual void Cleanup() { ClaimBanListService.Clean(); ServiceScope.Dispose(); }
/// <summary>释放 /// </summary> protected virtual void Dispose(bool disposing) { ServiceScope.Dispose(); }
public virtual void Dispose() { ServiceScope.Dispose(); ServiceProvider.Dispose(); }
public void Dispose() { ServiceScope.Dispose(); }
public void TearDown() { ServiceScope?.Dispose(); ServiceProvider?.Dispose(); }
/// <summary> /// Обработать событие остановки. /// </summary> public virtual void OnStopped() { ServiceScope.Dispose(); }
public virtual void Cleanup() { DB.ClearAllData(); ClaimBanListService.Clean(); ServiceScope.Dispose(); }
public void TearDown() { ServiceScope?.Dispose(); }
void IDisposable.Dispose() { ServiceScope.Dispose(); ServiceProvider.Dispose(); }