/// <summary> /// Processes sub module of module. /// </summary> private SubModule ProcessSubModule(Record record, Module module) { Debug.Assert(module != null); // module shall be specified string title; SubModule subModule = null; // If specified for the record if (module != null && record.TryGetValue(SubModuleCol, out title) && title != null) { // Key for cache is used to distinguish submodules // with the same titles for different modules ComplexKey key = new ComplexKey(module.Id, title); // Check that sub module already added to cache // and, correspondingly, to database // Add to DB new one overwise if (!m_subModuleCache.TryGetValue(key, out subModule)) { // Create new DTO subModule = new SubModule { Title = title, ModuleId = module.Id }; // Add to DB (we get at least it's ID) subModule = m_provider.CreateSubModule(subModule); // Add to cache m_subModuleCache.Add(key, subModule); } } return(subModule); }
/// <summary> /// Processes specified release of the revision. /// </summary> private Release ProcessRelease(Record record, Application app, string releaseColumnName) { string relTitle; Release rel = null; // Process release if specified for the revision // (app should be specified also) if (app != null && record.TryGetValue(releaseColumnName, out relTitle) && relTitle != null) { // Trim trailing and ending quotes relTitle = relTitle.Trim('"'); // Key for cache is used to distinguish releases // with the same titles for different applications ComplexKey key = new ComplexKey(app.Id, relTitle); // Check if already in cache if (!m_relCache.TryGetValue(key, out rel)) { // Create new DTO rel = new Release { Title = relTitle, AppId = app.Id }; // Add to DB rel = m_provider.CreateRelease(rel); // Add to cache m_relCache.Add(key, rel); } } return(rel); }
/// <summary> /// Processes module of application. /// </summary> private Module ProcessModule(Record record, Application app) { Debug.Assert(app != null); // application shall be specified string title; Module module = null; // If specified for record if (app != null && record.TryGetValue(ModuleCol, out title) && title != null) { // Key for cache is used to distinguish modules // with the same titles for different applications ComplexKey key = new ComplexKey(app.Id, title); // Check that module already added to cache // and, correspondingly, to database // Add to DB new one overwise if (!m_moduleCache.TryGetValue(key, out module)) { // Create new DTO module = new Module { Title = title, AppId = app.Id }; // Add to DB (we get at least it's ID) module = m_provider.CreateModule(module); // Add to cache m_moduleCache.Add(key, module); } } return(module); }