public void UpdateCacheItems <T>(ICollection <T> existingItems, ImportObjects <T> updatedItems) where T : DexihHubNamedEntity { foreach (var updatedItem in updatedItems) { switch (updatedItem.ImportAction) { case EImportAction.Replace: foreach (var existingItem in existingItems) { if (existingItem.Key == updatedItem.Item.Key) { existingItems.Remove(existingItem); break; } } existingItems.Add(updatedItem.Item); break; case EImportAction.New: existingItems.Add(updatedItem.Item); break; case EImportAction.Leave: break; case EImportAction.Skip: break; case EImportAction.Delete: foreach (var existingItem in existingItems) { if (existingItem.Key == updatedItem.Item.Key) { existingItems.Remove(existingItem); break; } } break; default: throw new ArgumentOutOfRangeException(); } } }
private void Initialize() { HubVariables = new ImportObjects <DexihHubVariable>(); Datajobs = new ImportObjects <DexihDatajob>(); Datalinks = new ImportObjects <DexihDatalink>(); Connections = new ImportObjects <DexihConnection>(); Tables = new ImportObjects <DexihTable>(); ColumnValidations = new ImportObjects <DexihColumnValidation>(); CustomFunctions = new ImportObjects <DexihCustomFunction>(); FileFormats = new ImportObjects <DexihFileFormat>(); RemoteAgentHubs = new ImportObjects <DexihRemoteAgentHub>(); DatalinkTests = new ImportObjects <DexihDatalinkTest>(); Views = new ImportObjects <DexihView>(); Apis = new ImportObjects <DexihApi>(); Dashboards = new ImportObjects <DexihDashboard>(); ListOfValues = new ImportObjects <DexihListOfValues>(); Tags = new ImportObjects <DexihTag>(); TagObjects = new ImportObjects <DexihTagObject>(); Warnings = new List <string>(); }