protected override void Dispose(bool disposing) { if (disposing) { if (customerRepository != null) { customerRepository.Dispose(); } if (localizationRepository != null) { localizationRepository.Dispose(); localizationRepository = null; } if (userManager != null) { userManager.Dispose(); userManager = null; } if (workflowMessageService != null) { workflowMessageService.Dispose(); workflowMessageService = null; } } base.Dispose(disposing); }
protected override void Dispose(bool disposing) { if (disposing) { if (contractorRepository != null) { contractorRepository.Dispose(); contractorRepository = null; } if (localizationRepository != null) { localizationRepository.Dispose(); localizationRepository = null; } if (businessTypeRepository != null) { businessTypeRepository.Dispose(); businessTypeRepository = null; } if (employeeRepository != null) { employeeRepository.Dispose(); employeeRepository = null; } if (vehicleRepository != null) { vehicleRepository.Dispose(); vehicleRepository = null; } if (employeeRelationshipTypeRepository != null) { employeeRelationshipTypeRepository.Dispose(); employeeRelationshipTypeRepository = null; } if (userManager != null) { userManager.Dispose(); userManager = null; } if (workflowMessageService != null) { workflowMessageService.Dispose(); workflowMessageService = null; } } base.Dispose(disposing); }
public bool RemoveRepository(ILocalizationRepository repository) { repository.MonitorStarted -= OnMonitorStarted; repository.MonitorStopped -= OnMonitorStopped; repository.MonitorNewVersion -= OnMonitorNewVersion; repository.MonitorStop(); var result = _localizationRepositories.Remove(repository); var localizationSource = _localizationSettings.Repositories.FirstOrDefault(r => r.Type == repository.Type && string.Compare(r.Repository, repository.Repository, StringComparison.OrdinalIgnoreCase) == 0); if (localizationSource != null) { _localizationSettings.Repositories.Remove(localizationSource); Program.SaveAppSettings(); } repository.Dispose(); return(result); }