public void BatchInfinityProcess() { var allBatches = _managerbatchType.GetEnabledBatchType(); foreach (var batch in allBatches) { //Check already added var checkAddedd = (from allTask in allTasks where CompareObject.AreObjectsEqual(allTask, batch) select allTask).ToList(); if (checkAddedd.Count == 0) { var task = new Task(() => AssignTaskForProcessing(batch), TaskCreationOptions.LongRunning); task.Start(); allTasks.Add(batch); } } //Check to delete foreach (var task in allTasks) { var checkExistance = (from batche in allBatches where CompareObject.AreObjectsEqual(task, batche) select batche).ToList(); if (checkExistance.Count == 0) { allTasks.Remove(task); } } }
List <VPC.Entities.BatchType.BatchType> ISecurityCacheManager.BatchTypesCache() { if (VPCCache.GetInstance().Contains <List <VPC.Entities.BatchType.BatchType> >(string.Format("{0}", EntityCacheType.BatchTypes))) { return(VPCCache.GetInstance().Get <List <VPC.Entities.BatchType.BatchType> >(string.Format("{0}", EntityCacheType.BatchTypes))); } var batchTypes = batchTypeManager.GetEnabledBatchType(); VPCCache.GetInstance().Set(string.Format("{0}", EntityCacheType.BatchTypes), batchTypes); return(batchTypes); }